Re: Who's responsible for deletion?

From: Patrick Schemitz (schemitz@ekp.physik.uni-karlsruhe.de)
Date: Mon Sep 14 1998 - 10:22:36 MEST


Hi Rooter,

> Patrick Schemitz wrote:
> [...] 
>  
> > In compiled code (using ROOT classes), using operator delete on
> > instances of ROOT classes sometimes causes a segfault later on.
> > (Of course I don't use the pointer after "delete", but nonetheless
> > the program dumps core. And of course I don't use delete on
> > automatic variables.)
> > 
> > Omitting the deletion of dynamic instances of ROOT classes (TBRIK
> > comes to my mind) seems _not_ to lead to a memory leak - how come?
> 
> [....]
> 
> Patrick,
> When you invoke the constructor for many Root objects, such as
> histograms, Trees, materials, Nodes, these objects are automatically
> added to some containers.
> In the case of TMaterial, these objects are added to the list
> of materials for the current geometry.
> When you will delete the geometry object, all materials in this
> geometry will be deleted.

I see, but why the core dumps when using delete on these objects?
Doesn't the destructor remove them from the containers?

Thanks for your help,

Cheers,	patrick

--
Patrick Schemitz, schemitz@ekp.physik.uni-karlsruhe.de
University of Karlsruhe (TH), Germany
Faculty for Physics, EKP, Ka'CDF Tracking Group



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:37 MET