Is there some general advice you can give on clean living? My confusion
partly lies with scope and the heap. My objects must survive until the
tree->Fill() happens. They are created in separate { } blocks, so if I don't
create them on the heap they would be deleted when they go out of scope
(right?).
Must I then keep track of all the objects I've put on the heap and then
delete them ('manually') after the Fill? I guess I expected the TClonesArray &
TMap Deletes to do this work for me. I'll see what TObjectTable tells me about
the survival rate.. I have some concern about what happens to the TMap's
inside the main TMap.
Thanks,
Richard
Rene Brun wrote:
> Richard Dubois wrote:
> >
> > I am attempting to produce files of 100 events of approximately 250kB
> > per event. When I test it on small events (a couple of particles per
> > event for a handful of events), all is well and the read-back structures
> > appear perfect. When I run on the bigger events on AIX, I get an
> > 'illegal instruction' abort, apparently in tree->fill().
> >
> > My tree consists of 5 branches: 4 TClonesArrays and 1 TMap. The TMap
> > 'value' objects themselves contain a TMap*. One of the TClonesArrays is
> > of MC particles. The other TClonesArrays objects contain pointers to
> > those MC particles. The TMaps contained in the top TMap also contain
> > pointers to the MC particles. split=0; bufsize=512000.
> >
> > The crashes appear to be history-dependent: if I excise a failing event
> > and run it by itself, all is well. I am wondering about event cleanup. I
> > do ->Delete's on all the TClonesArrays and the top TMap (not DeleteAll
> > on the TMap - there are many complaints about already removed objects if
> > I do(?)) after each tree->Fill(). All of the objects contained are
> > created on the heap. I don't do any other cleanup nor have I done
> > anything special for destructors for the contained objects.
> >
> > Should I be doing anything differently for cleanup or in setup of the
> > root file? Of course, I could simply have a bug in the code!
> >
>
> Richard,
> My guess is that you have a memory leak somewhere. You must take care
> of deleting all objects, etc created in the event cycle.
> To monitor what is happening, I suggest you include the following
> statement in your event loop
> gObjectTable->Print(); // requires #include<TObjectTable.h>
> This will show you the number of objects for each active class
> in memory.
>
> Rene Brun
-- Richard Dubois SLD, Stanford Linear Accelerator Center Richard@slac.stanford.edu http://www.slac.stanford.edu/~richard/ 650-926-3824 650-926-2923 (FAX)