Re: ROOT memory usage

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Jun 01 1998 - 10:16:46 MEST


Peter Steinberg wrote:
> 
> I have a ROOT tree that is about 6MB compressed, and maybe 15MB
> uncompressed (although I don't remember exactly how big at the moment).
> Now whenever I try to simply define the branches in order to read in
> events (i.e. I execute the code produced by TTree::MakeCode()) ROOT seems
> to want to unpack the whole thing into memory.  Usually this is fine, but
> when I try to use it on my 32MB home PC (linux or windows) it just swaps
> incessantly and I never get the prompt again.
> 
> Thus, my question is: Is there a parameter I can tune in the reading or
> writing to make a more memory-friendly tree?

Peter,
To see the memory usage for a Tree, use TTree::Print.
This will show you branch by branch how much space is used in memory.
In case you have many branches and if you have specified a large
buffer size for each branch, this can take a lot of memory.

Also check the following:
When you create the TTree object, this object is created in the
current file. If you do not have a file created at this point,
all the buffers will be created in memory. This may be fine for
small Trees but not for multiMegabytes Trees.
The sequence must be
    TFile *file = new TFile("myfile.root","recreate");
    TTree *tree = new TTree(...

Rene Brun



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:33 MET