[Article] D's Garbage Collector Problem

Marco Leise via Digitalmars-d digitalmars-d at puremagic.com
Thu Sep 11 09:35:05 PDT 2014


Am Thu, 11 Sep 2014 14:30:05 +0000
schrieb "Kagamin" <spam at here.lot>:

> >There are various api the compiler use to allocate from the GC. 
> >Some do not specify if the allocated memory contains pointers or 
> >not, and none do specify the type qualifier of the memory.
> 
> Is it true about pointers? Which functions?
> And why type qualifiers matter?

Immutable data structures cannot have pointers changed or set
to null. Also they can only reference other immutable data.
This means that they form sort of a big blob that is kept
alive by one or more pointers to it, but the GC never needs
to check the immutable pointers inside of it.

Shared/unshared may affect implementations that provide thread
local GC. E.g. only shared data needs to be handled by a
global stop the world GC. I'm not sure though.

-- 
Marco



More information about the Digitalmars-d mailing list