java - Sun GC 最大保留阈值

标签 java garbage-collection jvm

有一个关于 Sun GC 的问题。 Sun FAQ(1.4.2 的旧版)指出吞吐量收集器不使用 MaxTenuringThreshold (MTT) 参数。它仅用于 CMS。 http://java.sun.com/docs/hotspot/gc1.4.2/faq.html

(12) What should I do if my application has mid- or long-lived objects?

  • Objects that survive a young generation collection have a copying cost (part of the algorithm for a young generation collection is to copy any objects that survive). Mid- or long-lived objects may be copied multiple times. Use the -XX option MaxTenuringThreshold to determine the copying costs. Use -XX:MaxTenuringThreshold=0 to move an object that survives a young generation collection immediately to the tenured generation. If that improves the performance of the application, the copying of long-lived objects is significant. Note that the throughput collector does not use the MaxTenuringThreshold parameter.

我不知道如何验证这一点,但如果这是真的,吞吐量收集器如何确定何时将年轻对象提升为终身代?是每次年轻代填满时就执行此操作吗(换句话说 MTT = 0 ?)。

最佳答案

如果您谈论的是现代 (1.6.0) Sun GC,您可以下载源代码并自己弄清楚到底发生了什么。但当然,行为可能会随着补丁级别的不同而改变。

以下是一些引用 -XXmaxTenuringThreshold 选项的最新文档:

Google 搜索中会显示各种提示。但我在网上找不到任何明确的文档或你的问题的明确答案。

关于java - Sun GC 最大保留阈值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3427786/

相关文章:

java - JPQL 带条件的左外连接

java - 如何创建自定义按钮形状类

java - 在循环中添加到集合中的对象何时会被垃圾收集?

java - 为什么 JVM 需要这么长时间来 GC 我无法访问的对象?

java - 服务器上的 64 位 JVM,客户端上的 32 位 JVM,可以组合吗?

java - 垃圾回收会改变Java中的对象地址吗?

java - 测试时老虎机问题

java - 构造函数调用必须是使用 this 的构造函数中的第一个语句

c# - 为什么 GCHandle.Alloc 不能固定包含引用的对象?

Java 最小化依赖