by kllrnohj · 7y ago · 0 comments
1) Have bounded memory usage 2) Have consistent frame times
These goals are critical to maintain a consistent framerate on fixed-memory devices (aka, consoles). GCs, by their very nature, are not compatible with either of those goals. They need lots of spare memory to go fast, and they cause hiccups when collection happens. They are a non-predictable, non-consistent load.
If you're not working on a problem that is a sustained, consistent workload that needs sustained, consistent result generation then no, you probably won't see the same GC problems. GCs work great when the work is bursty or when the work has no latency associated with it. There's an awful lot of programs that fit in that model. Games just aren't one of them.
And in Unreal you can use GC in whatever components you feel like, it is a matter of weighting where it makes sense.
They are converting their C# code to HPC# which specifically does not do GC allocations.
https://youtu.be/NF6kcNS6U80?t=886
HPC#:
* no class types
* no boxing
* no GC allocation
* not exceptions for control flow
They are building a compiler to eliminate the GC from the GC'd language they were using.