Re: autodeletion of member or arrays, list... ?

From: Vincent Colin de Verdiere (Vincent.Colin.de.Verdiere@cern.ch)
Date: Thu Feb 17 2000 - 15:25:59 MET


yes,
I know of the problem and this is why I ask about an OPTIONNAL
feature ! If you want something which works for multiple structures at the
same time, you can use reference counting for most cases (except in
case of loops...). (there is plenty of literature on garbage collection
startegies otherwise !).

My idea is that, most of the time, you have a "master copy" of your
objects and some pointers to them in other structures. In this case, it is
good to make the master copy responsible fo deletion. Beside, one of the
other good point is avoid memory loss when you set an element in an array.
If you do, array.At(obj, 10) and an object is already at bin 10, you
may loose track of it without deleting it.

comments?

-- Vincent
 On Thu, 17 Feb 2000, Krzysztof Wozniak wrote:
>Yes, it can be practical in the case, when you put the object to 
>ONLY ONE TObjArray. However, if the same object is stored in two
>(or more) arrays, then after deleting the first array with all
>objects attached to it, trying to access elements of the second array 
>or during deleting the second array you obtain a nice seg. val. error
>:-(((
>To prevent such behaviour you have to type much more than a single line
>  A->Delete();
>
>So may be it's better to keep the present implementation?
>
>Krzysztof 



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