std.allocator: primitives for helping GC

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Thu May 1 10:37:33 PDT 2014


On 5/1/14, 10:25 AM, Dmitry Olshansky wrote:
> 01-May-2014 20:41, Andrei Alexandrescu пишет:
> So a replacement for current GC built on top of std.allocator.

That's the plan. There's a lot more work between here and there.

>>> How GC determines which allocator an object belongs to ?
>>
>> The idea is, for each root (whether conservative or typed), the GC first
>> calls resolveInternalPointer. That gives the memory chunk encompassing
>> that pointer. The GC uses that chunk to retrieve metadata about it and
>> then passes it to setAsUsed.
>>
>
> The Q is about which _allocator_ an object belongs to, in case there are
> many heaps.

Oh I see. All allocators that compose other allocators dispatch/forward 
calls to resolveInternalPointer appropriately. See in the code how some 
(like the Bucketizer) use a rather inefficient linear search through 
buckets. But there are simple ways to improve that.


Andrei




More information about the Digitalmars-d mailing list