3 ms·
Ask HN: Real time memory management?
Most VM:s I know of uses generational garbage collection because it has high throughput. Bump pointer allocations are very cheap and sweeping the young generation can be done very fast too. Like in 10 ms. But sooner or later you need to collect the old generation and that is slow. Like 500+ ms for a full (compacting) sweep of a big heap. This makes generational GC unsuitable for real time applications.
I know there are ways to minimize pause times (https://www.azul.com/resources/azul-technology/java-garbage-collection/), but I don't like it. Generational GC is already very complicated to implement so adding pauselessness to it makes it much harder.
So I'm looking for an automagic memory management system or algorithm with the following properties (preferable one that has already been implemented in an open source VM):
a) algorithms not uber complicated to implement
b) guaranteed pause times < 5 ms/allocation
c) requires no programmer cooperation, e.g no weak references
d) scales well for huge heaps and multiple threads
Would reference counting fit my requirements? I think not because it can't deal with reference cycles.