JVM垃圾收集 [英] JVM Garbage collection
问题描述
使用 -XX:+ UseParallelGC
并且是默认收集器使用多个线程。使用 -XX:+ UseConcMarkSweepGC
启用的并发低暂停收集器为并发收集器使用一个线程,但其停止收集世界是并行的。
只有很少使用的单线程gc -XX:+ UseSerialGC
是单线程的。
http://www.oracle.com/technetwork/java/gc-tuning -5-138395.html
http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html
In general ( as I am aware that there is a standard JVM implementation from Oracle/sun and other third parties as well like MS) , Does JVM create only one Garbage collection thread running as daemon to collect the garbage objects OR does JVM spawn more than one thread to accomplish the Garbage collection?
The "throughput collector" which is enabled with -XX:+UseParallelGC
and is the default collector uses multiple threads. The "concurrent low pause collector" enabled with -XX:+UseConcMarkSweepGC
uses one thread for concurrent collector but its stop-the-world collections are parallel.
Only the rarely used single threaded gc -XX:+UseSerialGC
is single threaded.
http://www.oracle.com/technetwork/java/gc-tuning-5-138395.html
http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html
这篇关于JVM垃圾收集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!