On 8/17/15 3:27 PM, Benjamin Thaut wrote:
Consider the following code

void* mem = malloc(500);
GC.addRange(mem, 500);
mem = realloc(mem, 512); // assume the pointer didn't change
GC.removeRange(mem);

This is actually unsafe, you have to remove the range first, or else if it *does* change the pointer, your GC is using free'd memory. Plus, if it does change the pointer, how do you remove the original range?

// if the GC kicks in here we're f*****
GC.addRange(mem, 512);

Can't you GC.disable around this whole thing?

-Steve

Reply via email to