Reddit: SafeD - The Safe Subset of D

Simen Kjaeraas simen.kjaras at gmail.com
Mon Mar 31 00:50:05 PDT 2008


On Mon, 31 Mar 2008 05:13:50 +0200, Kevin Bealer <kevinbealer at gmail.com>  
wrote:

> In languages like D and C++, the garbage collection is conservative, and
> this means that any pointer-sized block will be considered a pointer if
> it contains a value that is an address of any area that might still be
> live.
>This means that a few "garbage" blocks can be kept around because they
> are in a memory area which is pointed to by some random integer. This
> also means that in practice, even for sets of memory blocks that are
> not circular and might have an obvious destruction order could not be
> guaranteed to be destroyed in the right order, because a random integer
> in any of them might make them seem circular, so relying on any policy
> that tried to detect circularity would be unreliable at best.

In D, an allocated block can be marked as containing no pointers, and thus
will not be scanned for things looking pointers. I don't know how good the
GC/compiler is at understanding these things on its own, but at least a
programmer can make it more informed.

--Simen


More information about the Digitalmars-d-announce mailing list