Commit 82459763 authored by Marius Wachtler's avatar Marius Wachtler

gc realloc: subtract freed bytes from bytesAllocatedSinceCollection

parent 9cda8dda
......@@ -357,6 +357,8 @@ GCAllocation* SmallArena::realloc(GCAllocation* al, size_t bytes) {
#else
memcpy(rtn, al, std::min(bytes, size));
#endif
if (bytesAllocatedSinceCollection > size)
bytesAllocatedSinceCollection -= size;
free(al);
return rtn;
......@@ -772,6 +774,9 @@ GCAllocation* LargeArena::realloc(GCAllocation* al, size_t bytes) {
GCAllocation* rtn = heap->alloc(bytes);
memcpy(rtn, al, std::min(bytes, obj->size));
if (bytesAllocatedSinceCollection > size)
bytesAllocatedSinceCollection -= size;
_freeLargeObj(obj);
return rtn;
}
......@@ -994,6 +999,9 @@ GCAllocation* HugeArena::realloc(GCAllocation* al, size_t bytes) {
GCAllocation* rtn = heap->alloc(bytes);
memcpy(rtn, al, std::min(bytes, obj->size));
if (bytesAllocatedSinceCollection > obj->size)
bytesAllocatedSinceCollection -= obj->size;
_freeHugeObj(obj);
return rtn;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment