Mono is initially using Boehm-Demers-Wiser conservative garbage collector, which is also the default garbage collector.
Later, Mono had its own simple generational GC, Which is sgen. According to some test results in the mail list, the time efficiency of this sgen is very close to that of Boehm, and the memory is better.
Document address: http://www.mono-project.com/Compacting_GC,Note::Sgen has been developing, and its content may be different from the present.
I have read it and summarized it as follows:
- Divided into two generations
- Special processing of large objects. The default value is larger than 64 KB.
- Small objects use get_internal_mem/free_internal_mem for memory allocation. large objects use malloc/free of OS.
- 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:
- During program 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
Refer:
Http://en.wikipedia.org/wiki/Garbage_collection_ (computer_science)