GC behavior and Allocators

Kagamin via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 4 04:54:06 PDT 2014


If you reallocate doubling the size, it's likely such reallocs 
always move, so they should be equivalent to malloc+free, so your 
code can be

mem2 = alloc(sz*2);
mem2[] = mem1[];
addRange(mem2);
removeRange(mem1);
free(mem1);

if not, you need to lock the GC so that it won't interfere during 
realloc.


More information about the Digitalmars-d mailing list