3 ms·
Doubtful, because compaction requires updating the pointers to the new locations. In manual memory management, the compactor would have to stop the world, know
by gwbas1c 9y ago
Doubtful, because compaction requires updating the pointers to the new locations. In manual memory management, the compactor would have to stop the world, know enough about each structures' internal layouts to know where the pointers are, and then update all of them.
That would be impossible when trying to interoperate among different languages.
Manual memory management has its place, but if you need compaction, you should use a garbage collector. Manual memory management, (and reference counting,) aren't always faster than GC. (Malloc has overhead too, and can run slower than GC.)