Clarifcation on AA allocation
Bruno Medeiros
brunodomedeirosATgmail at SPAM.com
Fri Apr 14 08:57:38 PDT 2006
pragma wrote:
> Is there any way to 'manually' allocate memory for an AA in D?
>
> The problem that prompted me to ask this? Well, I have a class that maintains a
> set of HANDLES using an AA. Ideally, I'd like to be able to free these using
> the class' dtor(), but isn't there the possibility that the GC will eliminate
> the AA's memory before the dtor() is even called?
>
> I suppose I could instruct the GC to 'ignore' the AA via 'removeRange' for
> safety reasons, but I'd like to know if anyone else has a more elegant solution?
>
> - EricAnderton at yahoo
Actually, I don't /think/ that that (removeRange) would even work.
Correct me if I'm wrong (because the docs are not that clear) but
removeRange and AddRange only make the memory block not be scanned for
further roots. But the management ownership (manual-MM or GC-MM) is not
changed, and the array memory block may still be collected. Is that not so?
--
Bruno Medeiros - CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
More information about the Digitalmars-d-learn
mailing list