Skip to content

Better cleaning of logger objects in the Python Swig wrapper

Cédric Traizet requested to merge bug_python_logger_memory into develop

Summary

!405 (merged) added several classes to redirect logs from otb to the python console. Several type of logs are handled, and this MR corrects a bug caused by the ProgressReport logs. A progress report log is for example

Writing /tmp/out.tif...: 100% [**************************************************] (0s)

since !405 (merged), this type of log was managed with the ProgressReportManager class, this class contains a std::vector of watchers (StandardOneLineFilterWatcher) to build the logs for different processes, and a logOutputCallback to redirect the logs to Python. There was one ProgressReportManager for all applications (created when importing the otbApplication module`) and watchers were added to it every time an application was created. But these watchers were never destroyed which caused the memory consumption of otb to grow over time (See this thread on the forum).

With this MR each application has its own instance of ProgressReportManager as attribute, and thus the watchers are correctly released on application destruction.

Also the ProgressReportManager class now use smart point instead of new/delete to manage memory.

Copyright

The copyright owner is CNES and has signed the ORFEO ToolBox Contributor License Agreement.


Check before merging:

  • All discussions are resolved
  • At least 2 👍 votes from core developers, no 👎 vote.
  • The feature branch is (reasonably) up-to-date with the base branch
  • Dashboard is green
  • Copyright owner has signed the ORFEO ToolBox Contributor License Agreement
  • Optionally, run git diff develop... -U0 --no-color | clang-format-diff.py -p1 -i on latest changes and commit
Edited by Cédric Traizet

Merge request reports

Loading