- Major GC is cleaning the Tenured space.
- Full GC is cleaning the entire Heap – both Young and Tenured spaces.
This leads us to the point where instead of worrying whether the GC is called Major or Full GC, you should focus to finding out whether the GC at hand stopped all the application threads or was it able to progress concurrently with the application threads.
区分GC什么时候是Full gc 什么时候是major gc,可以通过看gc的时候是否暂停了全部的应用程序的线程,或者gc能否和应用程序并发执行
Unfortunately it is a bit more complex and confusing. To start with – many Major GCs are triggered by Minor GCs, so separating the two is impossible in many cases. On the other hand – many modern garbage collections perform cleaning the Tenured space partially, so again, using the term “cleaning” is only partially correct.
This leads us to the point where instead of worrying whether the GC is called Major or Full GC, you should focus to finding out whether the GC at hand stopped all the application threads or was it able to progress concurrently with the application threads.
结论:
Considering the situation, it is best to even avoid thinking in terms of Minor, Major or Full GC. Instead, monitor your application for latency or throughput and link the GC events to the results. Along with these events, you need to have the information whether the particular GC event forced all the application threads to stop or was part of the event handled concurrently.
If you enjoyed the content – this is the example chapter from our Garbage Collection Handbook, which is now available.
https://plumbr.io/blog/garbage-collection/minor-gc-vs-major-gc-vs-full-gc
https://sulangsss.github.io/2018/12/22/Java/JVM/Basic/Minor%20GC%20vs%20Major%20GC%20vs%20Full%20GC/