[Article] D's Garbage Collector Problem

Kagamin via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 13 13:54:33 PDT 2014


On Thursday, 11 September 2014 at 16:26:37 UTC, Marco Leise wrote:
> 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.

Also a certain discipline is required to construct 
shared/immutable object from the start instead of casting from 
thread-local mutable. And then how to add an object to a shared 
collection?

//callable without lock
void add(shared Object) shared;
//allocated thread-local object
void add(Object);
//but unshared collection contains unshared objects
void add(shared Object);
//thread-local object again
void add(Object) shared;

?


More information about the Digitalmars-d mailing list