Re: TFile effectivity

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Sat, 7 Nov 2009 07:48:39 +0100


The only thing that TFile keeps in memory is the TKey object (less than 100 bytes depending the length of the object name). Once you have written your object (histogram) to the file, you can delete it from memory.
You should be able to store millions of objects on the file. Note, however, than when you have a very large number of objects to write, it is better to
create a TTtree, where the only object per entry can be a histogram. The access time to each object will be faster (direct access) instead of a log(n) behavior when
writing them one by one as you do.

Rene Brun

Jakub Čermák wrote:
> Hello *,
> I'm writing an app which makes large number of histograms and some other graphs and then writes them to TFile. I'd like to avoid holding all the objects in memory, because they can be safely written to the file and discarded. I destruct all of them as soon as I don't need them, but I suppose TFile holds them somewhere in its cache. So the question is - is it possible to write a bunch of root objects into a file and discard them from memory? So the new histograms will be appended at disk to already written ones without need to hold them all in memory. I found a Flush function, but I don't know whether it's what I need.
>
> Thanks
>
> Best regards
>
> Jakub Čermák
> http://www.jcermak.cz
>
>
>
Received on Sat Nov 07 2009 - 07:48:50 CET

This archive was generated by hypermail 2.2.0 : Sun Nov 08 2009 - 17:50:03 CET