Keeping a list of instances and garbage-collection
grauzone
none at example.net
Mon Mar 30 23:55:22 PDT 2009
Actually, scratch that. Any 4 byte pattern can look like a pointer.
Unless you manage to encode it in a way the 4 byte cells look like
they're pointing into an address range not managed by the GC. For
example, most OSes reserve the last 1 or 2 GBs for the kernel. If your
byte quadruple looks like a pointer into the kernel, it's always safe
not to be scanned.
The only simple and reliable way is to store the pointer in a malloc'ed
or NO_SCAN'ed memory area.
More information about the Digitalmars-d
mailing list