Faster Virtual Method Dispatch

Craig Black cblack at ara.com
Tue Apr 25 08:15:34 PDT 2006


> Another advantage of gc (that isn't implemented, but could be, in D's gc) 
> is that allocated memory can be compacted. Compacting existing allocated 
> memory means that allocating a new object is as easy as bumping a pointer, 
> whereas the usual malloc algorithm requires searching a free list for a 
> best match.

It is also worth mentioning that compacting can be performed without 
scanning the stack.  Manual memory management can still be used along with a 
compacting allocator.  An compacting allocator would certainly outperform 
CRT malloc and free.  There is a tradeoff here because you can no longer use 
petal-to-the-metal algorithms that make use of raw pointers and pointer 
arithmetic, or if you do so, you would have to turn the allocator off 
temporarily to ensure safety.

-Craig 





More information about the Digitalmars-d mailing list