2 ms·
They put up their editor source code on Github recently (https://github.com/Unity-Technologies/UnityCsReference https://github.com/Unity-Technologies/UnityCsRef
by doomlaser 9y ago
They put up their editor source code on Github recently (https://github.com/Unity-Technologies/UnityCsReference https://github.com/Unity-Technologies/UnityCsReference), and originally it also included the full source to their runtime garbage collector, which ended up being the standard open source C++ boehm collector (https://github.com/ivmai/bdwgc https://github.com/ivmai/bdwgc) from the 90s.
Unity should replace it with a reference counting object management system, or update to a newer garbage collection technique to minimize the inadvertent sweeps that cause huge choppy frame rate drops.
- pcwalton 9y agoI hope they don't use naive reference counting. It would reduce throughput and would not eliminate pauses. A standard incremental or concurrent generational tracing GC would be a better choice. In games you have a lot of knowledge about timing that you can use to help schedule GC: you always know (or should know anyway) how much time there is until the next VBLANK, so you can use that to bound pause times for your major collections.
- merlish 9y agoThey're planning both. Reference counting/bump pointer allocation in-frame for temp stuff & no GC & manual memory management for the upcoming high-performance restricted C# subset data-oriented jobs code, and for full-fat real C# code they're slowly working to clean up their (C++ coded) runtime so that a non-conservative garbage collector can work. Re. Boehm, that was the garbage collector Mono shipped until they wrote SGen some years back. I'm quite excited by the work they're doing on performance. It looks great.