Phobos addition formal review: std.experimental.allocator

Tofu Ninja via Digitalmars-d digitalmars-d at puremagic.com
Thu Aug 13 14:20:08 PDT 2015


On Thursday, 13 August 2015 at 21:05:28 UTC, rsw0x wrote:
> On Thursday, 13 August 2015 at 20:56:36 UTC, Tofu Ninja wrote:
>> Something I thought about today, if a class or struct is 
>> allocated by an allocator(say a malloc based allocator) and 
>> one of its fields is populated with a reference to GCed 
>> memory, will the GC know to scan the allocator memory to keep 
>> that GCed memory alive?
>
> http://dlang.org/phobos/core_memory.html#.GC.addRange

Yeah I know about that, I was just asking if all the allocators 
would be marked to be scanned by default. Or if they might try to 
only mark as needing to be scanned if they contain types that 
could contain references.

The information of which types have internal references seems to 
be available at least to the GC. Theoretically an allocator could 
use that information to mark its allocations as needing to be 
scanned as well.

Or it could be a wrapper allocator that simply marks things as 
needing to be scanned when they need to be, that way it would be 
an opt-in type deal.

just some thoughts...


More information about the Digitalmars-d mailing list