Mono 3 now uses the sgen Garbage Collector by default, which improves the performance and scalability of the garbage collector to better utilize the multi-core processor hardware. Sgen has been transplanted to Windows and MIPS.
Mono is initially using Boehm-Demers-Wiser conservative garbage collector, which is also used as the default Garbage Collector in versions earlier than mono 3.0, the main problem with the Boehm garbage collector is that it cannot accurately read registers and stack frames. Because it cannot determine whether the given value is a pointer or a scalar, it always assumes that the given value is a pointer and marks the associated object as a surviving state. This will not only lead to misallocation of large memory blocks, but also make it difficult to compress the available space.
Later, Mono had its own simple generational GC, Which is sgen. Document address: http://www.mono-project.com/compacting_gc. use a precise generational garbage collector, similar to the. NET version of CLR. The sgen Garbage Collector uses two generations instead of three of. net, but uses an independent heap for large objects like. net.
- It can be divided into two generations. Previously, the description of its document was visible using conservative GC. Is a relatively backward implementation, without division,. Net CLR is three generations
- Special processing of large objects. By default, larger than 64 KB is used as large objects. Net large objects are larger than 20 KB and allocated to a special large object heap. Objects in the heap can be finalized and released like other small objects.
- Small objects use get_internal_mem/free_internal_mem for memory allocation, and large objects use OS malloc/free
- Mark/sweep is used for major collection.
- The collection process is "Stop the world"
- Conservative scanning object
- The old generation points to the new generation only in the following two cases, so they are tracked:
- ProgramDuring execution, a field is assigned a value.
- In the process of copying (on behalf of mobile), this object points to a new generation of Objects
Mono 3.0 added asynchronous support, improved sgen garbage collector, and other features
Build cross-platform applications with xwt
New mono GC
Sgen-concurrent mark
Sgen-concurrency and evacuation
Flame graphs for Instruments
How sgen rocks
Sgen-the write barrier
Sgen and dtrace
Sgen-finalization and weak references
Sgen-the major collectors
Sgen