Re: [ROOT] Memory leak when printing canvas

From: tome anticic (anticic@trinity.irb.hr)
Date: Sat Nov 03 2001 - 18:17:49 MET


Hi Rene,

The memory leak is about 800 bytes/iteration. Not much,
but my monitoring program has to continuously generate plots, full time,
so this is unfortunately a problem. I have observed the same effect on
separate machines (my RH6.2 laptop with 3.02./02, and on a  6CPU HP
netserver running RH7.1 with 3.01/06), so it is not some local error (but
one never knows...).

However, if printing gifs instead of eps, this problem dissapears!
Unfortunately I am running in batch mode, so I cannot use this.

	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");
> > > >  }
> > > > }
> > > 
> > 
> 

-- 

	Tome Anticic
  	Rudjer Boskovic Institute
  	Department of Experimental Physics
  	Bijenicka 54          
  	10000 Zagreb
  	CROATIA
  	Phone: 385-1-4561-028
  	Fax:   385-1-4680-239



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