Hi. I have understood: I expected a complete memory release for each file->Close(), but I didn't know that the memory is recycled. Now I fixed some problems in my destructors and is all ok. Thank you. Cheers Diego On Fri, 9 Apr 2004, Philippe Canal wrote: > Hi Diego, > > What do you mean the result are the same? Did you try a second serie > of open/close in the same process? > > I am expecting a memory increase after the first you open/close the file > (due to one time initialization). > > However on the second time they should be no memory increase. > > Philippe > > -----Original Message----- > From: Diego Faso [mailto:faso@to.infn.it] > Sent: Friday, April 09, 2004 3:45 AM > To: Philippe Canal > Cc: roottalk@cern.ch > Subject: RE: [ROOT] memory problem (TFile) > > > Hi. I tried, but the result is the same. I also tried to close the file > with the "R" option, but the situation is the same... > Could it be a problem in the TFile class? > Cheers > Diego > > On Thu, 8 Apr 2004, Philippe Canal wrote: > > > Hi, > > > > Instead of > > TFile f1 = TFile("trees.root") > > you should use > > TFile *f1 = new TFile("trees.root"); > > Instead of > > t->Delete(); > > use > > delete t; > > In addition to > > f1->Close(); > > use > > f1->Close(); > > delete f1; > > > > Also note that there is a fair amount of one-time initialization, loading, > > creating that can happen the first time (in a process) you use one of ROOT > > facility. You should actually compare the result __after__ the first > time. > > > > I.e. > > (low amount of memory being used) > > TFile *f1 = new TFile("trees.root"); > > TTree *t = (TTree *) f1.Get("h127") > > delete f1; > > gROOT->Reset(); > > (some higher amount of memory being used) > > TFile *f1 = new TFile("trees.root"); > > TTree *t = (TTree *) f1.Get("h127") > > delete f1; > > gROOT->Reset(); > > (SAME amount of memory being used.) > > > > Cheers, > > Philippe. > > > > -----Original Message----- > > From: owner-roottalk@pcroot.cern.ch > > [mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Diego Faso > > Sent: Thursday, April 08, 2004 9:54 AM > > To: roottalk@cern.ch > > Subject: [ROOT] memory problem (TFile) > > > > > > Good afternoon. I need to open, read and close several root files in a > > 'for loop'. > > I encountered a problem of memory allocation: the memory allocated for the > > 'root' process does not decrease when I close the file > > > > Here is an example: > > ------------------------------------------- > > (prompt)# root > > (root process memory = 33908) > > > > root [0] TFile f1 = TFile("trees.root") > > (root process memory = 35552) > > > > root [1] TTree *t = (TTree *) f1.Get("h127") > > (root process memory = 37492) > > > > root [2] t->Delete() > > (root process memory = 37492) > > > > root [3] f1.Close() > > (root process memory = 37492) > > > > root [4] gROOT->Reset() > > (root process memory = 37496) > > ------------------------------------------- > > > > How can I solve this problem? > > > > My machine is: > > > > - Linux red hat 9.0 > > - gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) > > - root version 4.00/02 > > (I noticed the same problem for the root version 3.10.02) > > > > > > Cheers > > Diego Faso > > > > > > >
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:07 MET