Re: [ROOT] Memory Leaks

From: Eddy Offermann (eddy@rentec.com)
Date: Wed Apr 04 2001 - 23:08:06 MEST


 Hi Dimitris,
 
 Just picking one from your list:
 
 Graph->Fit(..)
 
 If you look in TGraph.cxx, you see that a lot is going on and among others
 quite a few "new" statements.
 For example:
> 
> //*-*- Store fitted function in histogram functions list and draw
>    if (!fitOption.Nostore) {
>       if (!fFunctions) fFunctions = new TList;
>       if (!fitOption.Plus) {
>          TIter next(fFunctions, kIterBackward);
>          TObject *obj;
>          while ((obj = next())) {
>             if (obj->InheritsFrom(TF1::Class())) delete obj;
>          }
>       }
>       fnew1 = new TF1();
>       grF1->Copy(*fnew1);
>       fFunctions->Add(fnew1);
>       fnew1->SetParent(this);
>       fnew1->Save(xmin,xmax);
>       if (fitOption.Nograph) fnew1->SetBit(TF1::kNotDraw);
> 
>       if (TestBit(kCanDelete)) return;
>       if (gPad) gPad->Modified();
>    }
> 
 So with the right option, you will store each fitted function (TF! object)
 in a function list, expalining part of the new allocated memory.
 
 I bet that a lot of the other memory can be explained along the same lines
 
 
> > X-Authentication-Warning: pcroot.cern.ch: majordomo set sender to owner-roottalk@root.cern.ch 
using 
> -f
> > From: "Dr. D. Sideris" <d.sideris@ic.ac.uk>
> > To: <roottalk@pcroot.cern.ch>
> > Subject: [ROOT] Memory Leaks
> > Date: Wed, 4 Apr 2001 20:42:09 +0100
> > Mime-Version: 1.0
> > X-Priority: 3
> > X-Msmail-Priority: Normal
> > X-Mimeole: Produced By Microsoft MimeOLE V5.00.2314.1300
> > X-Filter-Version: 1.3 (wren)
> > 
> > Dear Rooters,
> > 
> > I am trying to tie down an application which is written in VC++6 using ROOT and MFC in win NT. I 
> seem to be getting memory leaks in many operations which are associated with canvases. I step 
through 
> each command in the program with the debugger and watch whether there is an increase in the size of 
> the program that is not reversed when a given process is finished. As an example I open a small 
> canvas with one pad I create a TGraph object with a small array of points and then I perform a fit 
to 
> those points. The I plot the results. Below are commands which take memory and never return it:
> > 
> > TPaveLabel *pave = new .... -> 4k
> > 
> > Graph->GetXaxis()->SetTitle.... -> 200k
> > 
> > Graph->Fit(...)    -> 348k
> > 
> > canvas->update   -> 100k
> > 
> > 
> > I'm not hasty to hold root responsible for those leaks, because sometimes there are other 
> inconsitencies in the coding which cause indirectly innocent calls to leak. However because my 
> application doesn't seem to leak anywhere else appart from the neighbourhood of canvases, that 
> narrows it down. If someone has any good advise I'd be gratefull.
> > 
> > 
> > Regards
> > 
> > Dimitris
> > 
> > P.S. I use root version 2.25/03
> 

Eddy A.J.M. Offermann
Renaissance Technologies Corp.
Route 25A, East Setauket NY 11733
e-mail: eddy@rentec.com
http://www.rentec.com



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:41 MET