Hi,
I have written a TSelector based off the one shown here: root.cern.ch/root/html532/src/T … w.cxx.html
It basically has a bunch of TTreeFormula that I want to loop over and evaluate for each entry of a tree.
I’ve found that when I run on PROOF, my TSelector starts using up lots of memory very quickly, compared to running without PROOF where it doesn’t use much at all.
In the above selector, the following logic takes place:
Init() : Compile the variables - i.e. create the TTreeFormula
Notify() : call UpdateFormulaLeaves on the manager
When I run on PROOF, I seem to see the following behaviour:
Notify() Gets called first at the start of each file
Init() Gets called next at the start of each file
When not running on PROOF, the Init method only gets called once, at the start of the job
I added some code to my TSelector to monitor memory usage. I saw a small increase in usage between the Notify and the Init method:
14:43:59 1625181 Wrk-0.0 | Info in TProofMultiDraw::Notify: virtual memory used = 398080
14:44:03 1625181 Wrk-0.0 | Info in TProofMultiDraw::Init: virtual memory used = 399624
But then I get a big increase in memory during the re-call to CompileVariables:
14:44:04 1625181 Wrk-0.0 | Info in TProofMultiDraw::Init: virtual memory used after recompile = 413744
This was after I already updated the code so that each time CompileVariables is called, it first tries to delete all existing TTreeFormula (i.e. it calls the ClearFormula method).
The problem seems to be that the creation of lots of TTreeFormula leads to memory leaks.
While resolving the leaking in TTreeFormula creation would be the best solution, for now it would suffice if I could use the existing TTreeFormula and get them to use the new tree. I tried using the ‘SetTree’ method to change the tree in all the formula but that lead to a crash.
So, in summary, what is the correct way to update/delete TTreeFormula, specifically in the context of a PROOF selector?
Thanks
Will