6 ms·
Most GC languages give you limited control over "when" garbage collection or allocation occur. With non-GC'd languages you can at least control them manually b
by redman25 2y ago
Most GC languages give you limited control over "when" garbage collection or allocation occur. With non-GC'd languages you can at least control them manually based on data structure choice (i.e. arenas), lifetimes, or manual drops.
- throwaway2037 2y agoDo you count Python, where the ref impl (CPython) uses reference counting, as a GC language? If yes, you have a better idea when GC will occur compared to non-deterministic GC like Java/JVM and C#/CLR.
- neonsunset 2y ago.NET has a few runtime knobs to control GC behavior at runtime: GC.TryStartNoGCRegion - https://learn.microsoft.com/en-us/dotnet/api/system.gc.trystartnogcregion https://learn.microsoft.com/en-us/dotnet/api/system.gc.tryst... GCSettings.LatencyMode - https://learn.microsoft.com/en-us/dotnet/standard/garbage-collection/latency https://learn.microsoft.com/en-us/dotnet/standard/garbage-co... The latter is what Osu! uses when you load and start playing a map, to sustain 1000hz game loop. Well, it also avoids allocations within it like fire but it's going to apply to any non-soft realtime system.
- neonsunset 2y agoThese are not mutually exclusive. In some GC-based languages these techniques are immediately available and some other languages take more abstracted away approach, relying more on the underlying runtime.
- pjmlp 2y agoAll of those options are available in Swift, D, C#, F#, Linear Haskell, OCaml with effects. Only pointing out the ones relevant in 2024, and not the whole CS history.