Hi ROOT folk,
The documentation for TTree::BuildIndex states:
"A TTreeIndex object pointed by fTreeIndex is created. This object will be automatically deleted by the TTree destructor. See also comments in TTree::SetTreeIndex()."
So, TTree owns the index created with BuildIndex.
However, if I call BuildIndex on a tree that already has an index built, I notice (from inspecting the code, no example script) that the old fTreeIndex index never gets deleted.
In an ideal world, BuildIndex would check whether any updates to the tree had been performed, so you'd have:
But certainly BuildIndex should at least delete the old index before creating a new one.