[ROOT] object ownership and memory management

From: Dave Casper (dcasper@uci.edu)
Date: Fri Dec 29 2000 - 21:45:18 MET


	Hi,

I am trying to understand what facilities are provided for object ownership
and memory management issues and clean up my own program to make it more
robust.

Root seems to have a variety of facilities for avoiding memory leakage, but
there is no global documentation that I have found.  There are a lot of
things going on behind the scenes with TStorage and libNew.  On Windows, I
have not been linking with libNew, since (some time ago) I found that it
caused problems.  In addition, I am calling my class library from Geant4,
and I'm not sure it is wise to impose a foreign, global operator new/delete
on that package.

TObject has a bit kNotDeleted; I'm not clear on how this will work without
libNew.  If one deletes something using a vanilla operator new, one is not
supposed to assume the memory in question is valid afterward.  Supposing one
deletes a TObject with the vanilla operator delete() (i.e. in the absence of
libNew), how can one use the kNotDeleted bit which is part of the memory
block you just deleted to check whether that block has, in fact, been
deleted?  kNotDeleted doesn't seem to be really documented anywhere, so many
I am misunderstanding its intent.

It would be good, I think, to eventually add a chapter on stuff like this to
the Root manual.

Dave
dcasper@uci.edu



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:40 MET