Skip to content
Snippets Groups Projects
Commit 77c5d973 authored by Rene Brun's avatar Rene Brun
Browse files

From Andrei:

fixes a major leak when merging files with collections written using kSingleKey option. In the analysis framework we use this option to be able to recreate the output content of an analysis task on the client side.

The merger was reading each key in memory and deleted the object at the end, but the container is not owner by default, so all objects inside leaked.


git-svn-id: http://root.cern.ch/svn/root/trunk@31204 27541ba8-7e3a-0410-8455-c3a389f83636
parent 7d5a219b
No related branches found
No related tags found
No related merge requests found
......@@ -335,6 +335,10 @@ Bool_t TFileMerger::MergeRecursive(TDirectory *target, TList *sourcelist)
TKey *key2 = (TKey*)gDirectory->GetListOfKeys()->FindObject(key->GetName());
if (key2) {
TObject *hobj = key2->ReadObj();
// Set ownership for collections
if (hobj->InheritsFrom(TCollection::Class())) {
((TCollection*)hobj)->SetOwner();
}
hobj->ResetBit(kMustCleanup);
listH.Add(hobj);
Int_t error = 0;
......@@ -395,6 +399,7 @@ Bool_t TFileMerger::MergeRecursive(TDirectory *target, TList *sourcelist)
}
} else if (obj->IsA()->InheritsFrom( "TCollection" )) {
obj->Write( key->GetName(), TObject::kSingleKey );
((TCollection*)obj)->SetOwner();
} else {
obj->Write( key->GetName() );
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment