How To Get Current Memory Utilization Of Root

Hello,

I have an application which receives histograms periodically and saves them to a file with different cycle numbers.

It opens a new file when started,
and it calls TObject->Write() for the histograms it receives.
and closes file on termination.

However if the program runs for a long time it consumes all the memory available and crashes.
There is no memory allocation which could cause a leak, and valgrind also doesn’t report a leak.

I believe I need to call TFile->Flush() or TFile->Write() at some point but I can’t do that whenever I receive a histogram since I may receive many histograms per second. So I thought of checking the current memory but couldn’t find how to do it. Searching through the forum didn’t help also.

Does anybody know how can I get current memory consumption of ROOT. Do I have to get it from the system or does ROOT have a method for it.

Thanks,
Sami

Are you clodsing/deleting your files?

see class TSystem and following functions accessed via gSystem

//---- System, CPU and Memory info virtual int GetSysInfo(SysInfo_t *info) const; virtual int GetCpuInfo(CpuInfo_t *info, Int_t sampleTime = 1000) const; virtual int GetMemInfo(MemInfo_t *info) const; virtual int GetProcInfo(ProcInfo_t *info) const;

Rene

Thanks for the quick reply,

The program is a standalone application. It opens file in the beginning and closes file when the histogram receiving finishes and exits. I can not close the file until then. I don’t know how long should I keep the file open. It maybe for just 1 histogram or for 100000 histograms.

I’ll try to see if I can keep memory under control with Write() and Flush() when memory reaches certain levels.

Thanks,
Sami