The old code subtracted oldSize from totalAllocated during deallocation, which required knowing the object size at free time. This was unsafe because it could read a freed object to determine its size. The new approach tracks bytesAllocated by only adding new allocations and relying on GC marking to account for freed memory, making it both correct and faster with less code.