Root file size question

Hi I am using root v5.27/04 on SL5, I have two root files with lots of subdirectories (about 100). Both files have similar histograms inside(about 4 histograms in each subdirectory). Recently I noticed one root file’s size became extremely large (about 1GB) while the other one is only about 1MB. I am wondering is there a method to test which subdirectory in the first file takes so much size? I believe there must be something wrong with the first file. Thanks a lot!

Hi,

Check the result of myfile->Map(). Check the result of myfile->ls();

Philippe.

Thanks for you help, I tried myfile->Map() for both files, the file with small size looks reasonable but the larger one reads as following (I only show the last part of the results):

20101209/114959 At:177837 N=359 TH1F CX = 8.53
20110119/141016 At:178196 N=343 TDirectory
20110119/145334 At:178539 N=73 TDirectory
20110119/145336 At:178612 N=73 TDirectory
20110119/145458 At:178685 N=129 TDirectory
Address = 178814 Nbytes = -68 =====G A P===========
20110119/141827 At:178882 N=73 TDirectory
20110119/145444 At:178955 N=129 TDirectory
Address = 179084 Nbytes = -322830265 =====G A P===========
20110119/145444 At:323009349 N=1 END

It looks like the last GAP taks so much space, can I figure out how to deal with the Gap? Also the actual file size is 1085924891 (1.1 GB) rather than 323009349 (0.3 GB), any possible reason for this? Thank you for your help!

[quote=“pcanal”]Hi,

Check the result of myfile->Map(). Check the result of myfile->ls();

Philippe.[/quote]

Hi,

No, it seems odd. Something must have gone wrong when writing the file.

Cheers,
Philippe.

OK, thanks a lot though… I think it is caused during writting/deleting .

[quote=“pcanal”]Hi,

No, it seems odd. Something must have gone wrong when writing the file.

Cheers,
Philippe.[/quote]

Hi,

Humm … Is this reproducible? Do you store something ‘temporarily’ in the file? Is there any TTree involved? What is your code looking like?

Philippe.

Hi, I am not sure I can reproduce it because I wrote to the root file over the past 3 months using different scripts. And I think it happened recently. There is no temporary or TTree in the file.

Several days ago, right after I created 10 subdirectories and wrote some histograms in the file, and then using TBrowser to look at the histograms. Odd thing was when I click dir1 through dir5, an error message like the one in Error in ReadBasketBuffers & Gaps with Map() happened (I don’t remember exactly the error message, but it looks like the same) , while dir6 through dir10 works fine.

I then deleted dir1 through dir5, and then wrote them again. Now the error message appeared when I use TBrowser to click dir6 through dir10, while dir1 through dir5 works fine . Noted that now dir6 through dir10 appeared before the new dir1 through dir5 in the root file, I suspected that any directory in there will have that error. My naive solution is to delete dir1 through dir10 first, created 5 empty directories which I won’t use (hoping they could occupy the space that may cause error), then write dir1 through dir10 again. Now the problems is solved. But no more error when I click the empty directories.

I am not sure whether this is related to the sudden change of the file size, but it is really odd to me.

[quote=“pcanal”]Hi,

Humm … Is this reproducible? Do you store something ‘temporarily’ in the file? Is there any TTree involved? What is your code looking like?

Philippe.[/quote]

Hi, I was trying to run the tutorial copyFile Code as in root.cern.ch/root/html/tutorials … les.C.html
I only changed the root file name that to be copied as in Line 70 to 73. For the normal root file, this code works fine. But for the extremely large root file, after copying some subdirectories, an error like following appear:

KEY: TH1F v2_CtauE_frac_dt;2 v2_CtauE_frac_7<v2_Pt<7.5 GeV/c
KEY: TH1F v2_CtauE_frac_dt;1 v2_CtauE_frac_7<v2_Pt<7.5 GeV/c
Error: Symbol #include is not defined in current scope copyFiles.C:43:
Error: Symbol exception is not defined in current scope copyFiles.C:43:
Syntax Error: #include copyFiles.C:43:
Error: Symbol G__exception is not defined in current scope copyFiles.C:43:
Error: type G__exception not defined FILE:/export/home/has64/hepserv01_repos/BcJpsiPi/./copyFiles.C LINE:43
*** Interpreter error recovered ***

Any suggestions? Thanks a lot!

[quote=“pcanal”]Hi,

Humm … Is this reproducible? Do you store something ‘temporarily’ in the file? Is there any TTree involved? What is your code looking like?

Philippe.[/quote]

[quote]But for the extremely large root file[/quote]Is it large because there there is many histograms and is it large because there are trees. If it is because of many histograms, you are probably running out of memory and might need to explicitly delete the histogram after copying them. If it is because of large TTree, you may need to prevent them from closing the file if it reach the size ‘limit’ by setting the size limit very very high (See TTree::SetMaxTreeSize).

Cheers,
Philippe.

PS. You can also try running your example under valgrind (and/or gdb) to see more information about the problem.