Tree and memory

I have a code reading a tree and process it …

It looks like this:

TFile* ofile = new TFile(ofilen, “recreate”);//I woul like a file-resident tree
TChain* DATA_TREE = NULL;

 if(treen == ""){
    DATA_TREE = (TChain*) TD->Get("DATA_TREE");
 }else{
    DATA_TREE = (TChain*) TD->Get(treen);
 }

I read one file with 4 brantches (TLorentVectors), in the file there are several 100.000 events. the size of the file ~100Mb.
The code arrives to the “DATA_TREE = (TChain*) TD->Get(treen);” line and within 5-6s
it eats all my memory …

this happens also when I try to do the same from CINT.

The root-files were created with 5.18 and processed with 5.24

What am I doing wrong?

k.

Your Tree is likely a memory-resident Tree. Could you tree.Print() and post the result?

René

[quote=“brun”]Your Tree is likely a memory-resident Tree. Could you tree.Print() and post the result?

René[/quote]

Thank you for the quick response …
However I cant produce the required output because the tree.Print() also eats my memory withins some seconds …
Unfortunately the code which produces the trees is not my work, i cant see what is going on in it.
Is there any way to transfer a memory resident tree to file resident? (without reading it in the memory?)

Thanx,
k.

Could you do:

root > TFile f("myfile.root"); root > f.Map(); >x.log

and post the file x.log

rene

[quote=“brun”]Could you do:

root > TFile f("myfile.root"); root > f.Map(); >x.log

and post the file x.log

rene[/quote]

Here is the log file …
Thanx,
k.

oops something went wrong …

Regards, k.
x.txt (7.41 KB)

Your Tree when compressed and written to the file has a size of 105 MBytes with a compression factor of 8.8. To read it in memory you need at least 900 MBytes of RAM. How much memory has your computer?
Anyhow, you should never produce memory resident Trees of this size.
To produce a disk-resident tree, you must open a file in “create”, “recreate” or “update” mode (ie a writable file), then create your Tree.

René

Thanx for the reply …
I have 2Gb of memory, but I guess, this will be the problem …
Thanx …

k.