Re: [ROOT] Memory leak when printing canvas

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Nov 02 2001 - 18:53:21 MET


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