RooFit for loop fitTo explodes in memory usage

There seems to be some discussion about a similar error before but was quite some time ago and was resolved (2012)

Everytime I call fitTo there seems to be various roofit objects that are created and are not cleaned after every iteration. I cannot get RooTrace::dump() to output anything but I am able to use RooTrace::printObjectCounts() to output the object counts. It seems fitTo creates a bunch of RooAbsCollection objects that are not cleaned which starts to consume all the memory. I can see the resident memory usage go up when looking at the top command. I put together a small program that I think shows this problem.

Tried with root 6.08 and 6.23. (761 Bytes)

Hello @lan13005,

Taking a quick look at the code, it seems there is a memory leak somewhere. Could you please create a GitHub issue here to keep track of this problem and its solution? Do not forget to attach the test program showing the problem.


Ok no problem. I started a github issue:

Thanks, @lan13005!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.