Dear ROOT experts,
I have found the following weird memory issue.
The problem is that I observe a very different memory usage when accessing trees that should be very similar.
I use the following code:
{
static ProcInfo_t info;
const float toMB = 1.f/1024.f;
TFile *f = new TFile("file1.root");
TTree *t = (TTree*)f->Get("tree");
gSystem->GetProcInfo(&info);
printf(" res memory = %g Mbytes\n", info.fMemResident*toMB);
printf(" vir memory = %g Mbytes\n", info.fMemVirtual*toMB);
t->GetEntry(123456);
gSystem->GetProcInfo(&info);
printf(" res memory = %g Mbytes\n", info.fMemResident*toMB);
printf(" vir memory = %g Mbytes\n", info.fMemVirtual*toMB);
}
when I run it on file1.root, the output is:
[quote] res memory = 110.797 Mbytes
vir memory = 248.898 Mbytes
res memory = 206.938 Mbytes
vir memory = 344.91 Mbytes
[/quote]
while if i run it on file2.root, i get:
[quote] res memory = 110.492 Mbytes
vir memory = 248.5 Mbytes
res memory = 243.832 Mbytes
vir memory = 1431.67 Mbytes
[/quote]
So >1GB difference between the two.
Both files are of similar size (2.9 and 2.8GB respectively), containing the same tree structure, and produced from the similar input files but just a different subset of them.
The Print() method for the tree in file1.root shows:
[quote]*Entries : 5388513 : Total = 11303126030 bytes File Size = 3021195181 *
-
: : Tree compression factor = 3.74 *
[/quote]
while for file1.root:
[quote]*Entries : 5333526 : Total = 11178390906 bytes File Size = 2980833544 *
-
: : Tree compression factor = 3.75 *
[/quote]
What makes this significant difference in memory usage?
The question is relevant cause when I use these files as inputs to my batch jobs, I might hit the memory threshold of the batch system when the memory usage is unexpectedly large.
Another maybe useful and weird piece of information, is that if I do an hadd of file1+file2, I don’t see any unexpected increase in memory usage, even if I get an entry corresponding to file2. But if I hadd in the opposite order file2+file1, I see the unexpectedly high memory usage.
Any help would be appreciated.
Bruno