Using Print(), possible memory leak?

Hi,
I am using ROOT version 4.04 on a Solaris 9 system and I am experiencing a possible memory leak when using the Print() command in a loop as in the following sample code:

TCanvas *canvas = new TCanvas(1); TF1 *plot = new TF1("plot","sin(x)",0,6); plot->Draw(); canvas->Print("sample.gif","gif"); delete plot; delete canvas;
I estimate the leak to be about 3kB per use of the Print() command. However, when using Print(“sample.jpg”,“jpg”), I estimate the leak to be about 800 bytes per use. Using “top” I noticed the memory usage going up for my program. By commenting out the Print() command, the memory usage remained constant. This loop will be called many thousand times, so this leak is a significant problem.

I noticed this was discussed in 2001, and it was fixed. Thanks in advance for any help.

Olivier will investigate next Monday

Rene

Hi Rene,
Okay, thanks for your help.

I am looking at your problem right now. I do not see exactly what you described: When I start ROOT, the size is (in top): 23384 when I run your macro several times it grows up to 26396, but it doesn’t grow each time I run the macro and, after a while, it stabilizes. When I comment the Print() command in your macro I get the same effect except that the final size is 24848. Can you confirm that behaviour ? do you really see a constant growth each time you run the macro ?

Hi,
I try run this macro and:

  • root 4.04.02g, yes, I really see a constant growth each time (with Print() command)
  • root CVS (12sep), all works OK (without growth)

Jan

Ok, so this problem is solved. Thanks !