RE: Make a TFile delete its objects, that were read into memory?

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Thu, 19 Jul 2007 09:23:11 -0500


Hi Hans,

> It appears to me, as if this method creates a new object on the heap for
every
> Get( ) call, even when the same object was already loaded into the memory,

> resulting in a large memory consumption after some time.

It should not, unless you requested a specific cycle (in which case it deletes the previous object and create a new one). [But then again you did not specify which version of ROOT you are using]

So it sounds like the issue would be that you do have a lot of histograms and may want to delete them once you no longer need them

Cheers,
Philippe.

-----Original Message-----
From: owner-roottalk_at_pcroot.cern.ch [mailto:owner-roottalk_at_pcroot.cern.ch] On Behalf Of Hans Dembinski
Sent: Thursday, July 19, 2007 6:32 AM
To: Root Group
Subject: [ROOT] Make a TFile delete its objects, that were read into memory?

Dear Root users/developers,

I have a program, which reads repeadidly TH2Ds from a TFile and works with them, using the TFile::Get( ) method.

It appears to me, as if this method creates a new object on the heap for every
Get( ) call, even when the same object was already loaded into the memory, resulting in a large memory consumption after some time.

However, I found a way to stop this by closing and reopening the TFile regularly at a certain point in the program, which nicely deletes all theses

memory copies of its content.

My question is, is there a more elegant way to delete and/or limit the memory
copies without manually keeping track of the pointers or by simply closing the file and reopening it?

Thanks and best regards,
 Hans

-- 
Dipl.-Phys. Hans Dembinski

Tel.: +49 241 80 27324

III. Phys. Inst. A (3A)
Physikzentrum
RWTH Aachen
52056 Aachen
Received on Thu Jul 19 2007 - 16:22:59 CEST

This archive was generated by hypermail 2.2.0 : Thu Jul 19 2007 - 23:50:01 CEST