Fast GC allocation of many small objects

Steven Schveighoffer schveiguy at yahoo.com
Mon Apr 2 19:11:00 UTC 2018


On 4/2/18 2:51 PM, Per Nordlöw wrote:
> On Monday, 2 April 2018 at 18:22:43 UTC, Steven Schveighoffer wrote:
>> You may be interested in this proposal, which was inspired by trying 
>> to implement a reserve feature for AAs (requires a similar mechanism).
>>
>> https://issues.dlang.org/show_bug.cgi?id=17881
>>
> 
> Ok, thanks. I'll push for it.
> 
> One thing, though, that boggles me; how does the GC know where each 
> class instance start and what type it has when I the allocator 
> constructs it using `emplace` in my Region? So that the GC knows which 
> destructor to call where.

It probably doesn't. Yet another reason to have a feature for this 
supported by the GC instead of a wrapper allocator.

> Furher, is it ok to use my allocator to allocate both pod, structs and 
> classes? Or aren't allocators supposed to be used in that way?

An allocator can be used to create anything AFAIK.

-Steve


More information about the Digitalmars-d-learn mailing list