The purpose of D (GC rant, long)

Sean Kelly sean at f4.ca
Sat Oct 28 12:20:43 PDT 2006


Sean Kelly wrote:
> Dave wrote:
>>
>> Not really 'initialization' as it just clears the unused portion of 
>> the 'bin', but it's still overhead that std.c.stdlib.malloc() doesn't 
>> have.
>>
>> The important point is that currently the initialization/clearing in 
>> itself takes longer than stdlib.malloc, so no matter how fast the 
>> allocator is, initialization will be a bottleneck.
>>
>> Any ideas on how to optimize that?
> 
> I'm not sure of the ideal approach for Phobos, but in Ares I have 
> separate malloc and calloc methods exposed.  So I'll likely just change 
> calloc to initialize the entire block instead of just the allocated 
> portion, and remove the spare space initializer from mallocNoSync.

You know, one thing to be said for the current approach is that it will 
result in fewer memory 'leaks' because unused memory is initialized to a 
value that is guaranteed not to look like a reference to actual memory. 
  I may leave things as-is.


Sean



More information about the Digitalmars-d mailing list