Re: [ROOT] gROOT->Reset() behaviour

From: Damir Buskulic (buskulic@lapp.in2p3.fr)
Date: Tue Oct 03 2000 - 15:58:36 MEST


Hi Suzanne,

This is what I understood :
the principle is if one creates an object via new, that person will have
to delete it. If the system creates an object via new, it will have to
delete it, if it's the user, it's his duty. This is no matter what you
do, even a gROOT->Reset(). If you allocate memory via new, as for
example

a = new int[100];

the gROOT->Reset call will just remove the (global) pointer "a" but will
not free the memory since YOU are responsible for that part. The only
problem is that you do not have anymore access to that memory since the
pointer is not there anymore.
That's why I asked if the allocated memory could be tracked by the
interpreter, at least for the part that is explicitely allocated in the
interpreter environment. This would allow the consistent freeing of
memory.
I'm just not sure it's possible.

Did I say something wrong ?

Damir

Suzanne Panacek wrote:
> 
> Hi Damir, Rene,
> >From your discussion it is not clear to me if a gROOT->Reset() deletes the
> object and hence frees the memory or if it just removes the variable from
> the interpreter (somehow)? Could you clarify?
> 
> Also it is not totaly clear if a Reset treats variables on the stack
> differently than variables on the heap. Could you explain?
> 
> Suzanne
> 

-- 
=====================================================================
| Damir Buskulic                  | Universite de Savoie/LAPP       |
|                                 | Chemin de Bellevue, B.P. 110    |
| Tel : +33 (0)450091600          | F-74941 Annecy-le-Vieux Cedex   |
| e-mail: buskulic@lapp.in2p3.fr  | FRANCE                          |
=====================================================================
mailto:buskulic@lapp.in2p3.fr



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