I am trying to run a Cut Optimization study and hence repeatedly execute various methods from RooFit/RooStats/HistFactory in a loop over ~14.000 entries (different cut configurations).
I noticed that my code was running fast at the beginning, but became slower and slower as time passed by, up to the point that a full run of the study is merely impossible. Looking at the memory usage (using "top"), I saw that the memory usage of my code was huge and ever increasing, hinting towards a memory leak.
Setting up a minimal example of what I was trying to do and using valgrind to trace the leak, I am by now pretty sure that the memory leak does not originate from my code, but instead from somewhere within RooFit/RooStats/HistFactory. I attached a minimal example source file and a corresponding Makefile, reproducing the leak.
In the configuration given, the code performs an infinite loop, allowing to observe the memory leak in filling up the system memory as time goes by. If you want to investigate the leak with valgrind or similar utilities, you should first comment line 70.