What are the main differences between Java7's G1 garbage collector and mono's SGen garbage collector? I know both of them are of generational GC, but how are they different in performance wise and architecture wise?
Asked
Active
Viewed 792 times
1 Answers
2
First, lets review both GC collectors:
- Mono's GC can be found in :
- G1GC is described e.g. in How does the Garbage-First Garbage Collector work?.
The Working with SGen defines that SGen is a generation collector that implements two GC algorithms for its Major Heap : (i) copying collector and (ii) mark-and-sweep.
Thereofre, although both SGEn and G1 are generational, fundamental difference is that G1 generations are split into many blocks of the same size while SGen applies a more traditional approach - one generation is represented as one continuous space.
Further, SGen's copying collector is by nature compacting. On the other hand, the Mark-And-Sweep algorithm is similar to the Java's CMS collector. And thus you can ask yourself, what is the difference between CMS and G1. There is a lot of information out there about their differences.
-
Thanks for your comment. But I beg to differ one of your comment - SGen is similar to the Java's CMS collector. CMS is not of compacting type where SGen is like G1. – Anindya Chatterjee Dec 12 '13 at 09:13
-
Thanks, I checked SGen description again and updated the answer. It looks like it implements two collectors : Copying collector and MArk-and-Sweep. The first is compacting, the second one is not. – Aleš Dec 13 '13 at 04:40
-
1SGen's Mark And Sweep Collector does have the ability to also do compaction, as described in the above mentioned _Generational GC_ document under _Evacuation_. – Ivan Aug 02 '21 at 04:23