TTree SetCacheSize issues


So I have been getting these R__unzip: error in inflate (zlib) errors, when I run large files. And according to a previous post in this forum, I should be disabling the cache. I am using root_v5.16.00

I guess I have some confusion as to where I should exactly put the SetCacheSize(0) command. I am doing something like this and it is still not helping:-

TFile *sIGnal;
sIGnal = new TFile (filname,“RECREATE”);
TTree *tree;
tree = new TTree(“MtreeVar”,“Mtuple tree Variables, Physics”);
MontrealLoc *stkphy = new MontrealLoc;

It fails with the error -

R__unzip: error in inflate (zlib)
Error in TBasket::ReadBasketBuffers: fNbytes = 126894, fKeylen = 70, fObjlen = 528643, noutot = 0, nout=0, nin=126824, nbuf=528643
Error in TBranchElement::GetBasket: File:

What am I doing wrong?

  • Sujeewa


You need to call SetCacheSize on the input and not on the output tree (and/or you could also try upgrading to ROOT v5.24).


Hello Philippe,

Thanks for the reply!

So, I switched my root version to root_v5.20.00 (that’s the latest available yet here). And I run on a 64 bit machine. The runs that used to run fine in v5.16, now throws this error -

Error in TBufferFile::CheckByteCount: object of class PDataContainer read too few bytes: 31 instead of 35

each time it writes to the tree.

And the previous error message still persists. Note not all events had that previous problem of R__unzip: error in inflate (zlib) errors. The events that had that problem, still show that same problem.

Additionally, everytime a tree is filled I get the new TBufferFile::CheckByteCount error.

The code is rather complicated as it involves several classes, so is hard to post here. I was wondering if you had an idea as to why this error is showing? Do you think it will go away with v-5.24? In your earlier replies to other people I saw that this error should not show up in v-5.18, so I thought v-5.20 was good enough…

  • Sujeewa

Hi Philippe,

Ok, I am now on root_v5.24.00.Linux.slc4/ And I still have the exact same problems.

Do you have any idea on how to fix this?

I am attaching the main part of the code, I don’t know if that helps at all, as it is really part of a bigger group of classes.


I don’t see any obvious problem with the code. The problem could be with the input file. Can it be read with bare root?