This belongs in bug reports, but I could not submit one just now. Sorry! Instead of attaching my root file, I have placed it at
dls.physics.ucdavis.edu/~croat/P … sults.root
I created a root file which contains the “RooFitResults” of many fits. When I try to read them back in a loop as in the macro below, I find the RooFitResults start taking up lots of memory, so I try to delete them. This eventually causes a seg violation, as in logfile below. Note that the seg violation seems to occur upon reading one of the results, though removing the ‘delete’ line from the macro allows it to complete.
I suspect something regarding RooDirItem, but I do not understand it’s purpose enough to try and debug it.
Cheers,
Chris
void results() {
TFile f(“results.root”);
TList *keylist= f.GetListOfKeys();
TIterator *iter= keylist->MakeIterator();
TKey key;
while ( key= (TKey)iter->Next() ) {
cout << "Attempt to read " << key->GetName() << endl;
RooFitResult *res= dynamic_cast<RooFitResult*>( key->ReadObjectAny( RooFitResult::Class() ) );
if ( !res ) {
cerr << "Couldn't read object " << key->GetName() << endl;
continue;
}
cout << "Deleting... " << endl;
delete res;
cout << "Done." <<endl;
}
}
root -b -q results.C
RooFit v2.04 – Developed by Wouter Verkerke and David Kirkby
Copyright (C) 2000-2005 NIKHEF, University of California & Stanford University
All rights reserved, please read roofit.sourceforge.net/license.txt
root [0]
Processing results.C…
Attempt to read catEntry18
Deleting…
Done.
Attempt to read catEntry31
Deleting…
Done.
Attempt to read catEntry100
Deleting…
Done.
Attempt to read catEntry118
*** Break *** segmentation violation
Generating stack trace…
0x401ff7f0 in THashTable::Add(TObject*) + 0x46 from /usr/lib/root/libCore.so.5.04
0x401fff62 in THashTable::Rehash(int, bool) + 0x112 from /usr/lib/root/libCore.so.5.04
0x401ff91a in THashTable::Add(TObject*) + 0x170 from /usr/lib/root/libCore.so.5.04
0x401fecb5 in THashList::AddLast(TObject*) + 0x41 from /usr/lib/root/libCore.so.5.04
0x4019d56d in TList::Add(TObject*) + 0x1b from /usr/lib/root/libCore.so.5.04
0x4015eb5b in TDirectory::Append(TObject*) + 0x3f from /usr/lib/root/libCore.so.5.04
0x41da3030 in RooDirItem::appendToDir(TObject*, bool) + 0xe8 from /usr/lib/root/5.04/libRooFit.so
0x41da9c28 in RooFitResult::RooFitResult(char const*, char const*) + 0x16c from /usr/lib/root/5.04/libRooFit.so
0x41f40261 in from /usr/lib/root/5.04/libRooFit.so
0x40219a70 in TClass::New(TClass::ENewType) + 0x3e from /usr/lib/root/libCore.so.5.04
0x4017714e in TKey::ReadObjectAny(TClass const*) + 0x23a from /usr/lib/root/libCore.so.5.04
0x403e4044 in from /usr/lib/root/libCore.so.5.04
0x40836091 in G__ExceptionWrapper + 0x5d from /usr/lib/root/libCint.so.5.04
0x40861ef5 in G__exec_asm + 0x9ef from /usr/lib/root/libCint.so.5.04
0x408f569e in G__exec_loop + 0x592 from /usr/lib/root/libCint.so.5.04
0x408f58e6 in G__exec_while + 0x92 from /usr/lib/root/libCint.so.5.04
0x408f84a7 in G__exec_statement + 0x2561 from /usr/lib/root/libCint.so.5.04
0x408c47d4 in G__interpret_func + 0x23dc from /usr/lib/root/libCint.so.5.04
0x408a9752 in G__getfunction + 0x235e from /usr/lib/root/libCint.so.5.04
0x4089e43f in G__getitem + 0x767 from /usr/lib/root/libCint.so.5.04
0x4089c8d2 in G__getexpr + 0xc27e from /usr/lib/root/libCint.so.5.04
0x4089017a in G__calc_internal + 0x312 from /usr/lib/root/libCint.so.5.04
0x408ff037 in G__process_cmd + 0x2359 from /usr/lib/root/libCint.so.5.04
0x4020c4a4 in TCint::ProcessLine(char const*, TInterpreter::EErrorCode*) + 0xba from /usr/lib/root/libCore.so.5.04
0x4020c5eb in TCint::ProcessLineSynch(char const*, TInterpreter::EErrorCode*) + 0x4f from /usr/lib/root/libCore.so.5.04
0x40148329 in TApplication::ProcessFile(char const*, int*) + 0x9d5 from /usr/lib/root/libCore.so.5.04
0x401478d1 in TApplication::ProcessLine(char const*, bool, int*) + 0x5f9 from /usr/lib/root/libCore.so.5.04
0x4141d10a in TRint::Run(bool) + 0x298 from /usr/lib/root/libRint.so.5.04
0x08048e64 in main + 0x90 from /usr/bin/root.exe
0x41553ec0 in __libc_start_main + 0xd0 from /lib/tls/libc.so.6
0x08048d31 in TApplicationImp::ShowMembers(TMemberInspector&, char*) + 0x3d from /usr/bin/root.exe