Re: [ROOT] Calling destructors

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Sat Jan 27 2001 - 11:17:10 MET


Hi Anton,

  this has nothing to do with ROOT but is a standard C++ feature.
If you create an object on the heap (with new) you have to explicitely
call delete somewhere down the line before the program exits.
If you create the object on the stack the destructor will automatically be
called as soon as the object goes out of scope (in case of .q). If that 
is not the case for you send me an example so we can investigate.

Cheers, Fons.




On Fri, Jan 26, 2001 at 11:54:33PM +0100, Anton Fokin wrote:
> Hi,
> 
> I noticed that ROOT doesn't call destructors for objects in memory when you
> quit it (by .q). Is it a kind of feature? I have for example Save() function
> in my TDataManager and since ROOT doesn't call data manager object
> destructor the data are not saved too. Of course I can add things in
> rootlogoff.C macro but ...
> 
> By the way, can some function (which will call destructors, close open
> files, sockets, etc.) be called on the system (root session) crash?
> 
> Regards,
> Anton

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910



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