Deleting drawn objects properly


I’ll try to explain my situation as clearly as possible. I’m working on a code that is C++, ROOT-based, plainly using the script potential for interactive plots. I’m currently cleaning it and I’ve figured that some of our memleaks where coming from graphs of histos stacked but not properly deleted.
As our user might want to keep all the plots made in a current interactive session (generally attached to an object), I came with the proposal of a “garbagecollector”, meaning a TObjArray with ownerhip set to true that contains every graphical object created and which is deleted at the destructor of the class used to produce a plot.

Unfortunately running the joined main_gr.C with valgrind points me to the line where i’m doing the draw (discussing lists/canvases) , and the results (shown in LogForDrawing_gr.txt) is independant of the use, or not (a simple boolean to change), of my dummy garbage collector (which suprises me as well). I’ve put the line to compile/run valgrind in the log file

If anyone has an idea, I’m puzzled
Thanks in advance
LogForDrawing_gr.txt (12 KB)
main_gr.C (1.22 KB)

I, once again, forgot to mention that i’m running with 5.34.32