TGraphError Fit memory leak

Dear All,

In my analysis I am trying to do hbom method hence on purpose randomly (according to tracking efficiency) loosing tracks in events. I need to fit 5 values (e.g sum of pT) only with y (statistic) errors, because x values represents number of hbom iteration, and then extrapolate. To determine the error of the method I do toy experiments, where I just “wiggle” each point according to gaussian distribution with sigma as statistical error and fit them again .

The problem is that when I set up the x errors as 0, I have huge memory leak because the number of toy experiments is around 1000 for each bin and there are 26 bins for each distribution. To run it over several distributions at once is almost impossible and system rather kill the process.

I tried to simulate the problem on simple example ( MemLeak.cxx ) with positive memory leak.

For compilation I use g++ and I was curious if it could be the problem of using root 6 (lRelease 6.06/02 - 2016-03-03). So I installed root 5 (Release 5.34/36 - 2016-04-05) and tried it again with negative result on memory leak. Therefore it seems that the problem is really connected with the version of root.

I have been working with root maybe for an year now so I don’t have much experience yet. I guess that one solution is to use root 5 instead but I am just curious about this problem. What exactly is misbehaving in root6 and where? To do so I tried to use Valgrind (output for both root version enclosed). Is this how it should be in root6 or is it a bug? Thank you in advance.

Matouš
val_r6_output.txt (335 KB)
val_r5_output.txt (3.31 KB)
MemLeak.cxx (1.03 KB)

Hi Matouš,

thanks for reporting.
I can reproduce the behaviour. We’ll come back to you with a solution.

Cheers,
Danilo

Hi,

The memory leak is in the linear fitter. If you use option “G” (to use Minuit) it should be fine. We will investigate this.
There is also a small error in your macro, you are using in TGraphErrorSetPoint an array “eyl[n]” with an index larger than the array size.

Cheers

Lorenzo

The memory leak in the TLinearFitter class is now fixed in the ROOT master version.
Thank you for reporting this problem

Lorenzo

As you suggested it works fine with option “G”. I am glad that I don’t have to rewrite the code to work with root 5. Thank you for advice and explanation.

Matouš