Sure, if all your objects are mutable, then that can work, but a lot of stuff in core libraries are not, and you can’t control those allocations, short of not using them. There is also sun.misc.Unsafe, which has freeMemory, but first of all, I don’t know if that works for arbitrary addresses, or just ones previously allocated from the allocateMemory method, and anyways, I don’t think there’s a reliable way to get the address of an arbitrary object in the first place. But to add both of those pieces of functionality should be a pretty small patch to the jvm code anyways, so if someone were really motivated, it may not be all that much work anyways.