std.allocator ready for some abuse

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Mon Sep 14 11:25:20 PDT 2015


On 09/14/2015 10:46 AM, bitwise wrote:
> On Saturday, 12 September 2015 at 06:45:16 UTC, bitwise wrote:
>> [...]
>>
>> Alternatively, GC.addRange() could return a value indicating whether
>> or not the range had actually been added(for the first time) and
>> should be removed.
>>
>>    Bit
>
> Maybe the solution is as simple as specifying the state of memory that
> should be received from an untyped allocator.
>
> It could be explicitly stated that an untyped allocator should give out
> raw memory, and should not initialize it's content or add any ranges to
> the GC. While it may seem obvious for a C++ allocator not to initialize
> it's contents, I think this makes sense in the presence of a GC.
>
> I would appreciate some feedback on this.
>
>     Bit

I think what we need here is a GCConnectedAllocator that can be inserted 
at the bottom of the allocation foodchain to insert calls to addRange 
and removeRange appropriately. -- Andrei


More information about the Digitalmars-d mailing list