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.