Re: [ROOT] on whether to delete root objects

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Nov 01 2001 - 11:21:46 MET


Hi Thomas,

With
 - MyClass *c = new MyClass(); c is on the heap
 - MyClass c;  c is in the stack

Rene Brun

Thomas Bretz wrote:
> 
> Hi Rene,
> 
> > This will work, but I would not recommend this approach.
> > Note that if you insert histPtr in a ROOT collection TList, TObjArray, etc
> > if you call list->Delete(), the collection classes check if the object is
> > on heap or not. If it is not in the heap, the object is simply removed from the
> > list and it is not deleted.
> 
> Something I never understood... When is a object 'on the heap'?
> 
> Thanks,
> Thomas.



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:05 MET