Memory management in an Online Monitor

I’m writing an online monitor to watch over some of our signals for the benefit of people on shift. The code polls a rootfile whose TTrees are “AutoSave”'d every 5 seconds (in a separately running program). It seems to run well, but I’m watching “top” (on Fedora Core 1, ROOT 4.00/03)… as the program runs, and the items under “SIZE”, “RSS”, and “%MEM” steadily increase as the program runs. I took this as an indicator that it was using up more and more of my system’s physical memory.

I decided to make a very basic version of my code (without having an updating rootfile), to see if I could track down the problem… here it is (run after the rootfile loaded up):

void curious() {

  TCanvas *c1 = new TCanvas("c1","Whatever");
  c1->Divide(2,2);

  TTimer *timer = new TTimer();
  timer->SetCommand("dodraw()");
  timer->Start(2000);


}

void dodraw() {
  c1->cd(1);
  R->Draw("adc22_0:ev_num");

  c1->cd(2);
  R->Draw("adc22_1:ev_num");

  c1->cd(3);
  R->Draw("adc22_2:ev_num");

  c1->cd(4);
  R->Draw("adc22_3:ev_num");
  
  c1->cd();
  c1->Update();

}

When started… top tells me “SIZE” is around 32M. My rootfile size is 200M. After running this CINT macro for 3 hours, “SIZE” is now 220M… and climbing. This is the same behavior that I’m seeing in my more complicated code.

Ideally… we’d need a code like this to run for quite a long time (at least 1 week straight). I’m a bit worried that I’m going to run out of physical memory here… Is there something I should add to aleviate this problem? Or perhaps I’m just misinterpretting top’s output…

Thanks.

Hi,

There is indeed a memory leak associated with the drawing of scatter plots (this should be fixed shortly). In the meantime you can work around the problem by naming the histogram:

Cheers,
Philippe.

This memory leak has been fixed in ROOT 4.00/04

Cheers,
Philippe.

This memory leak has been fixed in ROOT 4.00/04

Cheers,
Philippe.

Would I be able to backport this fix to 3.10/02?

Some of our collaborators are weary about upgrading to the Bleeding CVS ROOT while an experiment is running.

Hi,

It should be possible to backport it to ROOT 3.10/02.
You will need to apply the same modifications as described at
root.cern.ch/viewcvs/treeplayer/ … f_format=l

Cheers,
Philippe.