Fast GC allocation of many small objects

rikki cattermole rikki at cattermole.co.nz
Fri Mar 30 20:55:49 UTC 2018


On 31/03/2018 9:46 AM, Per Nordlöw wrote:
> On Friday, 30 March 2018 at 20:38:35 UTC, rikki cattermole wrote:
>> Use a custom allocator (that could be backed by the GC) using 
>> std.experimental.allocators :)
> 
> https://dlang.org/phobos/std_experimental_allocator.html
> 
> is massive.
> 
> I guess I should allocate my nodes using
> 
>      auto node = theAllocator.make!StrNode("alpha");
> 
> Could someone please give a working example of a GC-backed 
> `theAllocator` suitable for my allocation pattern?

The default theAllocator is the GC :)

Also see[0] and "Sample Assembly"[1] which will really interest you I think.

[0] https://dlang.org/phobos/std_experimental_allocator_gc_allocator.html
[1] https://dlang.org/phobos/std_experimental_allocator_building_blocks.html


More information about the Digitalmars-d-learn mailing list