Re: [ROOT] Memory leak when printing canvas

From: Rene Brun (Rene.Brun@cern.ch)
Date: Sat Nov 03 2001 - 17:43:28 MET


Hi Tome,

I cannot reproduce this problem.
Could you tell me what is the estimated memory leak per iteration ?

About your second question. If you run interactively,
you can produce a gif file directly by replacing
     c1->Print("xxx.eps");
by
     c1->Print("xxx.gif");

Rene Brun

On Sat, 3 Nov 2001, Tome Anticic wrote:

> 
> Thanks for the quick reply.
> 
> Unfortunately, I tried it under root 3.02/02 and the problem persists.
> gObjectTable->Print() reports no problems however. But the
> memory usage (using top) keeps increasing on each iteration
> of the Print() method... 
> 
> Actually, I also have a related question. The reason I 
> print the postscript file is to convert it to gif (via
> pstopnm and ppmtogif). This is a slowish process, and I
> was wondering if there is a faster way to get a gif of
> a canvas?
> 
> 	Tome
> 
> 
> On Fri, 2 Nov 2001, Rene Brun wrote:
> 
> > Hi Tome,
> > 
> > This problem has already been fixed.
> > Move to a more recent version.
> > 
> > Rene Brun
> > 
> > Tome Anticic wrote:
> > > 
> > > Hi,
> > > 
> > > I would really appreciate if somebody could tell
> > > me what I am doing wrong.
> > > 
> > > I need to generate a lot of plots at short intervals.
> > > So I do a graph in a canvas and use the Print() method
> > > to print a postscript file . But I noticed  that the
> > > Print() method causes an increasing amount of memory to be
> > > used. How can I prevent this and free the memory?
> > > Below is a sample code where
> > > this can be observed (do top from a shell and watch...)
> > > 
> > > Any help would be appreciated. I use root 3.00 /egcs 2.91.66
> > > 
> > > Thanks,
> > >                 Tome
> > > 
> > > void testMemory()
> > > {
> > > Float_t X[100];
> > > Float_t Y[100];
> > > 
> > >  TCanvas *c1;
> > >  c1 = new TCanvas("c1","canvas");
> > > 
> > >  for (Int_t i=0; i< 100;i++) {
> > >      X[i] = i;
> > >      Y[i] = i;
> > >  }
> > >  TGraph* grh = new TGraph(100,X,Y);
> > >  grh->Draw("AL");
> > > 
> > >  while (1) {
> > >      cout << " do plot " << endl;
> > >      c1->Update();
> > >         // this causes memory to be used and NOT freed
> > >      c1->Print("xxx.eps");
> > >  }
> > > }
> > 
> 



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