Hello All,
There is a way that ROOT facilitates keeping track of objects created on the
heap using "new" . One can create a TList container and then add every object
to the container as its created. So for example:
//Create a TList
TList *fTrashCan = new TList;
//An ordinary class
myClass *A = new myClass;
anotherClass *B = new anotherClass;
//Add them to the container
fTrashCan->Add(A);
fTrashCan->Add(B);
//When you are done with the object, ROOT will free the memory taken by A and B
in one fatal swoop
fTrashCan->Delete();
//Then free up memory by fTrashCan
delete fTrashCan;
This may help someone
Cheers,
Adam
This archive was generated by hypermail 2.1.2 : Mon Feb 24 2014 - 14:07:28 EST