Memory leaks?

From: Giorgio De Nunzio <giorgio.denunzio_at_aliceposta.it>
Date: Wed, 24 Aug 2005 16:03:00 +0200


Hi all!
Another question for you kind gurus..
I do not understand what ROOT objects in a program should be deleted and what should not because they
already are implicitly.

Take, for example, guitest.C
I issued gObjectTable->Print() before .x guitest.C and after exiting it, and the object
counts differed, giving 5492 before, and 6523 after execution (I simply launched guitest, then I immediately exited calling no menu item etc).
Does this not mean menory leaks?

Another strange thing: start root (5.0.2 in my case) and give  gObjectTable->Print()
You obtain some value for total cts.
Call Print() again: you get (at least I do!) different figures; in particular I get 3045 the first time, 3151 the second time (and the following
ones). If I try it again (exit root, start it again, Print, Print), in general
these figures change.
Why??

OK, I said, I issue this command once, then I throw this result (perhaps ROOT
creates some objects the first time I issue a command), I Print again and use
the latter values to check my programs.

Now, try this one:
root
gObjectTable->Print() (I get cts = value1) .x basic.C
gObjectTable->Print() (I get cts = value2, far larger, of course) gObjectTable->Print() (I get cts = value3, lower than value2 but different from value1)
gObjectTable->Print() (from now on I get cts = value3)

Any explanation?

Another example, simply creating and destroying some objects:

Print() gives 3041
Print() again gives 3150
Print() again gives 3150  (stable, so begin experimenting)
TCanvas *c = new TCanvas
Print() gives 3791
Print() again gives 3834
Print() again gives 3834 (stable)

delete c
Print() gives 3558 (why not 3150?)
Print() again gives 3558 (this time it is immediately stable)

Another test (continuing the preceding one):

TCanvas *c = new TCanvas
..3837
..3838
..3838

delete c
..3561
..3561
..3561

And so on..
You can see that I cannot use gObjectTable->Print() to check if there are memory leaks.
Is it my problem or is there an explanation?

Another question (same sort of problems):

when I issue a command like

   mdiFrame->AddFrame(new TGTextButton(mdiFrame, new TGHotString("&Press me!"), 1),

                      new TGLayoutHints(kLHintsCenterX | kLHintsCenterY));

am I sure that all those "new" stuff are deleted when the frame is deleted? I cannot delete them by hand because they have no name..

Thanks!
Giorgio



Dr. Giorgio De Nunzio

Dipartimento di Scienza dei Materiali
Universita' di Lecce

tel. 0832 297545
fax 0832 297548

giorgio.denunzio_at_unile.it Received on Wed Aug 24 2005 - 16:08:06 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:12 MET