GetEntry() crash when more than 2000 entries


I’m facing a crash probably due to GetEntry() method. I had the same problem with root 5.28 and 5.34.
The macro I’m trying to use is, for the moment, a very simple one.

int evtID=0, NDeposits=0;
float dep_E[100];
float dep_E0=0;
int parentPDG=0;

vector filenames;
for(int ii=0;ii<10;ii++){
string file;
file = Form(“new/Th-232_TOP_%d_user.root”,ii);
cout << filenames[ii].c_str() << endl;

for(int i=0;i<1;i++){
TFile * infile = new TFile(filenames[i].c_str(), “OPEN”);
cout << filenames[i].c_str()<<endl;

TTree * myTT = (TTree*) infile->Get(“TT”);


for(int j=0; j GetEntries() ; j++){

myTT-> ResetBranchAddresses();


Limiting the number of entry to 2000 (loop on j), it does not crash. However, when I try to extend the loop on the entire rootfile, especially in a loop on many rootfiles, I found a crash at the end of the loop on j, saying:

*** Break *** segmentation violation

There was a crash.
This is the entire stack trace of all threads:

#0 0x00007f68b100961e in waitpid () from /lib64/
#1 0x00007f68b0f9b609 in do_system () from /lib64/
#2 0x00007f68b30e615c in TUnixSystem::StackTrace() () from /afs/
#3 0x00007f68b30e3931 in TUnixSystem::DispatchSignals(ESignals) () from /afs/
#5 0x00007f68b109465a in __strcmp_ssse3 () from /lib64/
#6 0x00007f68b26b2e9c in G__searchvariable () from /afs/
#7 0x00007f68b26b4da0 in G__getvariable () from /afs/
#8 0x00007f68b25a5d7c in G__getitem () from /afs/
#9 0x00007f68b25b14d8 in G__getexpr () from /afs/
#10 0x00007f68b263ef72 in G__exec_loop(char const*, char*, std::list<G__FastAllocString, std::allocator<G__FastAllocString> > const&) () from /afs/
#11 0x00007f68b2637440 in G__exec_statement () from /afs/
#12 0x00007f68b2592154 in G__exec_tempfile_core () from /afs/
#13 0x00007f68b259248b in G__exec_tempfile () from /afs/
#14 0x00007f68b264a850 in G__process_cmd () from /afs/
#15 0x00007f68b30a441d in TCint::ProcessLine(char const*, TInterpreter::EErrorCode*) () from /afs/
#16 0x00007f68b30a3f03 in TCint::ProcessLineSynch(char const*, TInterpreter::EErrorCode*) () from /afs/
#17 0x00007f68b300b55a in TApplication::ExecuteFile(char const*, int*, bool) () from /afs/
#18 0x00007f68b3008acb in TApplication::ProcessLine(char const*, bool, int*) () from /afs/
#19 0x00007f68b1ec41ab in TRint::Run(bool) () from /afs/
#20 0x000000000040102d in main ()

The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.

#5 0x00007f68b109465a in __strcmp_ssse3 () from /lib64/

Root >

Do you have any idea to help me?

Many thanks!

Post here the output of:
(Well, a good idea would be to post the root file so one could check it.)

since TTree::GetEntries() returns a Long64_t try to use that data type in the loop, excluding any automatic static cast.
Lets say:

(...) for(Long64_t j=0; j <myTT->GetEntries() ; j++){ myTT->GetEntry(j); } (...)
that is more correct since TTree::GetEntry() has a Long64_t argument.
Hope that helps

have fun