3 ms·
The thing I really want is a garbage collector where you can specify a timeout before it stops running. Let it stop the world, but resume the world after 10ms
by Dwedit 1y ago
The thing I really want is a garbage collector where you can specify a timeout before it stops running. Let it stop the world, but resume the world after 10ms have passed or whatever.
- Rohansi 1y agoThey can't really provide that guarantee. It's possible for lower allocation rates but what happens when 10ms is not enough time to keep up with all of the new allocations? At some point it'll need to stop the world because it's not able to do a complete cycle. I like the way .NET does it where you can define regions to have the GC avoid running in [1]. You just need to declare how much memory the region should be able to allocate and it wouldn't run the GC unless it is exceeded. This is great for things like games where it's best to let the GC run while the GPU is rendering/presenting (note: not supported in Unity because they use Mono). [1] https://learn.microsoft.com/en-us/dotnet/api/system.gc.trystartnogcregion?view=net-9.0 https://learn.microsoft.com/en-us/dotnet/api/system.gc.tryst...
- zokier 1y agoSomething like Javas -XX:MaxGCPauseMillis?
- kikimora 1y agoDuring STW GC has to walk all the heap. Checking 50% of live objects tell you nothing about possibility of using memory at address X. Only after checking all objects you know that X is not occupied.