Re: [ROOT] Memory leak when printing canvas

From: Tome Anticic (tanticic@mail.cern.ch)
Date: Sat Nov 03 2001 - 16:32:35 MET


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