Memory Corruption with AAs
dsimcha
dsimcha at yahoo.com
Sun Apr 4 06:45:36 PDT 2010
== Quote from Michel Fortin (michel.fortin at michelf.com)'s article
> Question: if the container's memory isn't garbage-collected, how do you
> implement iterators, eh, ranges so that they are still memory-safe?
The way I'm picturing this being implemented is that a GC'd class instance exists
at the top level, and then the internal implementation-detail storage that the
class uses is implemented via malloc and free. This storage would get freed in
the class finalizer when the instance is GC'd. In this case all you'd need to do
is make the range hold a reference to the class instance so it wouldn't be GC'd.
More information about the Digitalmars-d
mailing list