[Article] D's Garbage Collector Problem
via Digitalmars-d
digitalmars-d at puremagic.com
Sat Sep 13 12:07:55 PDT 2014
On Saturday, 13 September 2014 at 18:06:47 UTC, Kagamin wrote:
> On Thursday, 11 September 2014 at 16:26:37 UTC, Marco Leise
> wrote:
>> 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.
>
> GC still should free unreachable parts of that blob.
>
>> 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.
>
> Can get in a way, when you need a thread-local immutable object.
Hmm... when is that necessary? Wouldn't `const` be enough?
AFAICS, `immutable` is mostly useful for shared data.
More information about the Digitalmars-d
mailing list