JVM垃圾收集 [英] JVM Garbage collection

查看:100
本文介绍了JVM垃圾收集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一般来说(因为我知道Oracle / sun和其他第三方以及MS都有标准的JVM实现),JVM是否只创建一个作为守护程序运行的垃圾收集线程来收集垃圾对象或者JVM产生多个线程来完成垃圾收集?

解决方案

使用 -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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆