原博一:https://blog.youkuaiyun.com/tjiyu/article/details/53982412
原博二:https://blog.youkuaiyun.com/tjiyu/article/details/53983064
原博三:https://www.cnblogs.com/cxxjohnson/p/8625713.html
三:
更多"Stop The World"信息请参考:《Java虚拟机垃圾回收(一) 基础》“2-2、可达性分析算法”
更多Serial收集器请参考:
《Memory Management in the Java HotSpot™ Virtual Machine》 4.3节 Serial Collector(内存管理白皮书):http://www.oracle.com/technetwork/java/javase/tech/memorymanagement-whitepaper-1-150020.pdf
《Java Platform, Standard Edition HotSpot Virtual Machine Garbage Collection Tuning Guide》 第5节 Available Collectors(官方的垃圾收集调优指南):http://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/collectors.html#sthref27
更多目标调优和GC自适应的调节策略说明请参考:
《Memory Management in the Java HotSpot™ Virtual Machine》 5节 Ergonomics -- Automatic Selections and Behavior Tuning:http://www.oracle.com/technetwork/java/javase/tech/memorymanagement-whitepaper-1-150020.pdf
《Java Platform, Standard Edition HotSpot Virtual Machine Garbage Collection Tuning Guide》 第2节 Ergonomics:http://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/ergonomics.html#ergonomics
更多Parallel Scavenge收集器的信息请参考:
官方的垃圾收集调优指南 第6节:http://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/parallel.html#parallel_collector
上面介绍的都是新生代收集器,接下来开始介绍老年代收集器;
更多Serial Old收集器信息请参考:
内存管理白皮书 4.3.2节:http://www.oracle.com/technetwork/java/javase/tech/memorymanagement-whitepaper-1-150020.pdf
《内存管理白皮书》 4.5.2节: http://www.oracle.com/technetwork/java/javase/tech/memorymanagement-whitepaper-1-150020.pdf
官方的《垃圾收集调优指南》8.8节 Incremental Mode:http://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/cms.html#CJAGIIEJ
《内存管理白皮书》 4.6.3节可以看到一些描述;
由于空间不再连续,CMS需要使用可用"空闲列表"内存分配方式,这比简单实用"碰撞指针"分配内存消耗大;
更多关于内存分配方式请参考:《Java对象在Java虚拟机中的创建过程》
总体来看,与Parallel Old垃圾收集器相比,CMS减少了执行老年代垃圾收集时应用暂停的时间;
但却增加了新生代垃圾收集时应用暂停的时间、降低了吞吐量而且需要占用更大的堆空间;
更多CMS收集器信息请参考:
《垃圾收集调优指南》 8节 Concurrent Mark Sweep (CMS) Collector:http://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/cms.html#concurrent_mark_sweep_cms_collector
《内存管理白皮书》 4.6节 Concurrent Mark-Sweep (CMS) Collector:http://www.oracle.com/technetwork/java/javase/tech/memorymanagement-whitepaper-1-150020.pdf
《垃圾收集调优指南》 9节:http://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/g1_gc.html#garbage_first_garbage_collection
《垃圾收集调优指南》 10.5节:http://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/g1_gc_tuning.html#important_defaults
更多G1收集器信息请参考:
《垃圾收集调优指南》 9节 Garbage-First Garbage Collector:http://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/g1_gc.html#garbage_first_garbage_collection
《垃圾收集调优指南》 10节 Garbage-First Garbage Collector Tuning:http://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/g1_gc_tuning.html#g1_gc_tuning
到这里,我们大体了解HotSpot虚拟机中的所有垃圾收集器,后面我们将去了解JVM的一些内存分配与回收策略、JVM垃圾收集相关调优方法……
【参考资料】
1、《编译原理》第二版 第7章
2、《深入理解Java虚拟机:JVM高级特性与最佳实践》第二版 第3章
3、《The Java Virtual Machine Specification》Java SE 8 Edition:https://docs.oracle.com/javase/specs/jvms/se8/html/index.html
4、《Java Platform, Standard Edition HotSpot Virtual Machine Garbage Collection Tuning Guide》:http://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/index.html
5、《Memory Management in the Java HotSpot™ Virtual Machine》:http://www.oracle.com/technetwork/java/javase/tech/memorymanagement-whitepaper-1-150020.pdf
6、HotSpot虚拟机参数官方说明:http://docs.oracle.com/javase/8/docs/technotes/tools/unix/java.html
7、《Thinking in Java》第四版 5.5 清理:终结处理和垃圾回收;