简体   繁体   English

超出了GC开销限制

[英]GC overhead limit exceeded

What is the sampling time JVM uses to throw 'java.lang.OutOfMemoryError : GC overhead limit exceeded'? JVM用于抛出'java.lang.OutOfMemoryError:超出GC开销限制'的采样时间是多少? I know you can control 98% and 2% with parameters GCTimeLimit and GCHeapFreeLimit but whats the sampling time? 我知道您可以使用参数GCTimeLimit和GCHeapFreeLimit控制98%和2%但是采样时间是多少?

From Java SE 6 HotSpot[tm] Virtual Machine Garbage Collection Tuning 来自Java SE 6 HotSpot [tm]虚拟机垃圾收集调整

the following 下列

Excessive GC Time and OutOfMemoryError 过多的GC时间和OutOfMemoryError

The concurrent collector will throw an OutOfMemoryError if too much time is being spent in garbage collection: if more than 98% of the total time is spent in garbage collection and less than 2% of the heap is recovered, an OutOfMemoryError will be thrown. 如果在垃圾收集中花费了太多时间,则并发收集器将抛出OutOfMemoryError:如果在垃圾收集中花费了超过98%的总时间并且恢复了少于2%的堆,则将抛出OutOfMemoryError。 This feature is designed to prevent applications from running for an extended period of time while making little or no progress because the heap is too small. 此功能旨在防止应用程序长时间运行,同时由于堆太小而很少或没有进度。 If necessary, this feature can be disabled by adding the option -XX:-UseGCOverheadLimit to the command line. 如有必要,可以通过在命令行中添加选项-XX:-UseGCOverheadLimit来禁用此功能。

The policy is the same as that in the parallel collector, except that time spent performing concurrent collections is not counted toward the 98% time limit. 该策略与并行收集器中的策略相同,只是执行并发收集所花费的时间不计入98%的时间限制。 In other words, only collections performed while the application is stopped count toward excessive GC time. 换句话说,只有在应用程序停止时执行的集合才会计入过多的GC时间。 Such collections are typically due to a concurrent mode failure or an explicit collection request (eg, a call to System.gc()). 此类集合通常是由于并发模式失败或显式收集请求(例如,对System.gc()的调用)。

in conjunction with a passage further down 与进一步向下的通道相结合

One of the most commonly encountered uses of explicit garbage collection occurs with RMIs distributed garbage collection (DGC). 使用RMI分布式垃圾收集(DGC)时,最常遇到的显式垃圾收集使用之一。 Applications using RMI refer to objects in other virtual machines. 使用RMI的应用程序是指其他虚拟机中的对象。 Garbage cannot be collected in these distributed applications without occasionally collection the local heap, so RMI forces full collections periodically. 在没有偶尔收集本地堆的情况下,无法在这些分布式应用程序中收集垃圾,因此RMI会定期强制执行完整收集。 The frequency of these collections can be controlled with properties. 可以使用属性控制这些集合的频率。 For example, 例如,

 java -Dsun.rmi.dgc.client.gcInterval=3600000 

-Dsun.rmi.dgc.server.gcInterval=3600000 specifies explicit collection once per hour instead of the default rate of once per minute. -Dsun.rmi.dgc.server.gcInterval=3600000指定每小时显式收集一次,而不是每分钟一次的默认速率。 However, this may also cause some objects to take much longer to be reclaimed. 但是,这也可能导致某些物体需要更长的时间才能被回收。 These properties can be set as high as Long.MAX_VALUE to make the time between explicit collections effectively infinite, if there is no desire for an upper bound on the timeliness of DGC activity. 如果不希望DGC活动的时间性上限,则可以将这些属性设置为Long.MAX_VALUE,以使显式集合之间的时间有效无限。

Seems to imply that the evaluation period for determining the 98% is one minute long, but it might be configurable on Sun's JVM with the correct define. 似乎暗示确定98%的评估期是一分钟,但可以在Sun的JVM上配置正确的定义。

Of course, other interpretations are possible. 当然,其他解释也是可能的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM