4 ms·
I see that there is a section (relatively short) on real time GC. But for anyone who has read the Handbook, how much emphasis is placed on GC in constrained env
by throwaway17_17 10mo ago
I see that there is a section (relatively short) on real time GC. But for anyone who has read the Handbook, how much emphasis is placed on GC in constrained environments. I have fought the urge to implement a 3D, modern AA game with GC just to prove it is viable outside all but the most resource poor platforms or the most AAAAA, cutting edge, every cycle counted, hyper optimized game. But I am transitioning to a slightly less focused area of responsibility at work and may have some free time to prototype and this may be how I spend my winter and spring free time.
- bjourne 10mo agoNot much. The book mostly covers theory and not platform-specific details. The explanations on various real-time gc algorithms are very thorough though.
- dafelst 10mo agoUnreal Engine has a GC for its internal object graph, so GC is already in use in a ton of games.
- 01HNNWZ0MV43FF 10mo agoWouldn't all the popular games based on Unity and written in C# count?
- charcircuit 10mo agoMinecraft is the best selling game of all time, uses GC, and is an indie game.
- znpy 10mo agoYeah but it’s a game category where is that’s viable
- charcircuit 10mo agoWhat do you mean? A 3D game with a dynamic environment doesn't sound like the best category for GC. Or do you just mean that it was a game that didn't write extreme performance optimizations.
- delusional 10mo agoThere's a bunch of caveats to that story. At one point (in one patch I recall) they got tired of passing around 3 floats separately for x, y, and z all the time, so they did what any reasonable programmer would do and created a "coordinate" structure. This created one of the worst performing partches of the game ever, and they had to back all the way out. They ended up just passing the separate floats around again. My takeaway is that GC doesn't have to be slow, it just imposes a bunch of new constraints on what can be fast.
- gf000 10mo agoValue types would solve that issue flawlessly.
- indigo945 10mo agoThe problem there is probably that Java cannot pass objects by value [1]. That incurs an additional layer of indirection when accessing the individual members of the struct, tanking performance. That's not a necessity, though - you can use a GC in languages that allow you to control whether structs get allocated on the heap or on the stack, and then you don't have this issue. For example, in Go, structs can be allocated on the stack and passed by value, or they can be allocated on the heap and passed by reference, and this is under the control of the application programmer [2]. [1]: Actually, according to the Java spec, Java does not have pass-by-reference, and objects are always passed by value. However, that's just strange nomenclature - in Java parlance, "object" names the reference, not the actual range of memory on the heap. [2]: The language spec does not guarantee this, so this is technically implementation-defined behavior. But then, there's really only one implementation of the Go compiler and runtime.
- pjmlp 10mo agoUS navy has weapons targeting systems on some battleships implemented in Java with realtime GC, equally France has missile tracking systems, also implemented in Java with realtime GC, courtesy of PTC and Aonix. https://www.militaryaerospace.com/defense-executive/article/16720700/thales-chooses-aonix-perc-virtual-machine-software-for-ballistic-missile-radar https://www.militaryaerospace.com/defense-executive/article/... https://www.lockheedmartin.com/en-us/products/aegis-combat-system.html https://www.lockheedmartin.com/en-us/products/aegis-combat-s... https://vita.militaryembedded.com/1670-aonix-uss-bunker-hill/ https://vita.militaryembedded.com/1670-aonix-uss-bunker-hill... Not all GC are born alike, and in real life there isn't "insert credit to continue".
- indigo945 10mo agoI think you would be hard-pressed to find a modern AA game that does not already use a GC. The major game engines Unreal and Unity are garbage collected - although they use manual memory management for some of their internals, the exposed API surface (including the C++ API) is designed with garbage collection in mind. Notably, the popular-with-hobbyists Godot Engine does not use a garbage collector. It uses reference counting with some objects, but does not provide cycle detection, thus requires all objects to be laid out in a tree structure (which the engine is built around).
- pjmlp 10mo agoReference counting is chapter 5 on the linked book.
- pizlonator 10mo agoReference counting isn’t garbage collection.
- gf000 10mo agoIt absolutely is (and as per another thread under another post, both pjmlp and me are notorious for correcting people on this specific point)
- pizlonator 10mo agoThey are not interchangeable. The semantics are observably different. Therefore, RC is not GC. Reference counting gives you eager destruction. GC cannot. GC gives lets you have garbage cycles. RC does not. I think a part of the GC crew reclassified RC as GC to try to gain relevance with industry types during a time when GC was not used in serious software but RC was. But this is brain damage. You can’t take a RC C++ codebase and replace the RC with GC and expect stuff to work. You can’t take a GC’d language impl and replace the GC with RC and expect it to work. Best you could do is use RC in addition to GC so you still keep the GC semantics.
- pizlonator 10mo agoUnreal has an incremental GC