Garbage Collection

Christoph Borgmeier (borg@mail.desy.de)
Mon, 1 Dec 1997 16:38:41 +0100 (MET)


Dear all,

is there the possibility to clean up the memory of objects, which have
been created by means of pointers of serialized objects?

I have an event class like this:

class Event
{
...
TObjArray* fMC_Tracks;
TObjArray* fMC_Vertices;
...
};

The objects contain pointers to objects of the same and of the other
object array. A `Clear' function was motivated by an example from the
release notes V1.01.txt.html (which I did not understand completely):

void Event::Clear()
{
TCollection::StartGarbageCollection();
fMC_Tracks->Delete();
fMC_Vertices->Delete();
TCollection::EmptyGarbageCollection();
}

The result is, that the static TCollection functions seem to make things
worse (in my example, ~200MB, instead of ~100MB, are allocated by reading
1000 events).

- is there a clean way to safely delete all objects read by one GetEvent
call?

- (just my curiousity:) is the CINT .garbage functionality completly
unrelated? How can I provoke it to do something? (Creating an Object in
the interpreter, then reassigning the pointer does not produce a garbage
entry.)

Thank you
Christoph

---------------------------------------------------------------------------
Christoph Borgmeier | Mail: DESY -F15-, Notkestr. 85, 22607 Hamburg
Humboldt Univ Berlin | Phone: +49 40 8998 2844
Email: borg@ifh.de |
---------------------------------------------------------------------------