Minor GC vs Major GC vs Full GC

http://www.importnew.com/15820.html

https://plumbr.io/blog/garbage-collection/minor-gc-vs-major-gc-vs-full-gc

  • Minor GC 会清理年轻代的内存。
  • Major GC 是清理老年代的内存。
  • Full GC 是清理整个堆空间—包括年轻代和老年代。
  • 所有的 Minor GC 都会触发“全世界的暂停(stop-the-world)”
  • 许多 Major GC 是由 Minor GC 触发的,所以很多情况下将这两种 GC 分离是不太可能的。

结论:MinorGC也会出触发STW发生。

扩展阅读:

https://stackoverflow.com/questions/16695874/why-does-the-jvm-full-gc-need-to-stop-the-world

涉及到:GC algrogithm

以及RedHat(OpenJDK)和Oracle(HotSpot)的实现。

https://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/cms.html#concurrent_mark_sweep_cms_collector

针对Java8的CMS垃圾收集器,其中有如下的一句:

(in particular, the application threads are stopped during minor collections).

特定情况下,当执行Minor Gabage Collection时,应用的线程被停止。(也就是说,Minor GC会出发Stop-The-World)。

猜你喜欢

转载自www.cnblogs.com/rgqancy/p/9090344.html