Roofit memory leaks

I am curious whether anyone else has noticed memory leaks while using Roofit. At first, I thought it was just the class I wrote (not deleting pointers). Anyone can try this at home, just fitTo() a simple gaussian hundreds of times, thousands even and watch the memory consumption grow. The memory consumption seems to grow even if all the pointers are deleted.

This is becoming a major problem in the analysis I’m working on, since I need to do thousands of fits.

I am to assume either no one has ever had memory problems with Roofit, or no one has tried to do hundreds of fits in one program?

I have reported your problem to Wouter Verkerke.

Rene

Thanks!

I noticed memory consumption from either the fitTo() or plotOn() functions.

Hi,

I would like to investigate your problem in a bit more detail. RooFit was (once)
thoroughly debugged for memory leaks, but some of the recently added features
might misbehave.

It is quite easy to see which objects RooFit creates by activating the memory tracing
options. Before you execute any RooFit macro type ‘RooTrace::active(1)’, which
will activate memory tracing. At the end of your macro, a call to 'RooTrace::dump()'
will show what objects are left in memory.

Also, if you could send me a working example, I be able to see (and fix) more.

Wouter

Here’s a macro that should illustrate the problem.
Increase the nfits argument to see increasing memory consumption.
The output of the memory tracing option mentioned in the last post is attached.
-Nathan

[code]void TestRooFit(const Int_t nfits=1)
{
TH1F *h=new TH1F(“h”,"",100,-10,10);
RooRealVar x(“x”,“x”,-10,10);
RooRealVar s(“s”,“s”,1,-10,10);
RooRealVar m(“m”,“m”,0,-10,10);
RooGaussian g(“gauss”,“gauss(x,m,s)”,x,m,s);
RooPlot *f=x.frame();

for (Int_t i=0; i<nfits; i++) {

for (Int_t j=0; j<1000>Fill(gRandom->Gaus(0,2));

RooDataHist d("d","",x,h);

  	g.fitTo(d);
d.plotOn(f);
g.plotOn(f);

f->Clear();
h->Reset();
}

}[/code]
RooFitTrace.txt (3.21 KB)

Let’s try that macro again w/o the [code] …

void TestRooFit(const Int_t nfits=1)
{
TH1F *h=new TH1F(“h”,"",100,-10,10);
RooRealVar x(“x”,“x”,-10,10);
RooRealVar s(“s”,“s”,1,-10,10);
RooRealVar m(“m”,“m”,0,-10,10);
RooGaussian g(“gauss”,“gauss(x,m,s)”,x,m,s);
RooPlot *f=x.frame();

for (Int_t i=0; i<nfits; i++) {

for (Int_t j=0; j<1000>Fill(gRandom->Gaus(0,2));

RooDataHist d("d","",x,h);

  	g.fitTo(d);
d.plotOn(f);
g.plotOn(f);

f->Clear();
h->Reset();
}

}

OK, no more inline code - now the macro is an attachment.
TestRooFit.C (538 Bytes)