Memory Ocuppancy Due to Many Fits

Hello dears,

I’m trying to understand and solve a problem of memory filling during a process I do in my code. I such process a have to do many fits (10000) in a TGraph where I plot variables that should be correlated. The fit itself is very simple since I need just a “pol1” function. However, I have to repeat those ~1.e4 fits other 100/1000 times. I tested just for 15 of these times and the memory ocuppancy is growing up (relatively fast btw). So, I suspect that something is being stored during the fit (is a comment the line that do the fit that problem does not arise). I searched for some solution trying to delete all the possible objects built during fit process but still the memory ocuppancy is growing up. Someone here already faced such kind of problem? Can you help me to solve it?


Did you run valgrind memcheck on the code to spot leaks?
Can you share the code?


Did you run valgrind memcheck on the code to spot leaks?
Can you share the code?[/quote]


I searched by that tool you told me… but seems that it just work for executables. Is it right? In my case I don’t compile the code to create a executable program… it is just called/compaled with Root and runs through Root. So, I think I can’t apply the tool. But, I think the problem is not related to the code itself… seems to be just the fit done by Root on the TGraphs (as I mentioned if I comment the line that call the fit - “graph->Fit(“pol1”)” - the memory is not full filled during the run.


could you post the code you are running?