<legend id='xRqD8'><style id='xRqD8'><dir id='xRqD8'><q id='xRqD8'></q></dir></style></legend>
<tfoot id='xRqD8'></tfoot>

<i id='xRqD8'><tr id='xRqD8'><dt id='xRqD8'><q id='xRqD8'><span id='xRqD8'><b id='xRqD8'><form id='xRqD8'><ins id='xRqD8'></ins><ul id='xRqD8'></ul><sub id='xRqD8'></sub></form><legend id='xRqD8'></legend><bdo id='xRqD8'><pre id='xRqD8'><center id='xRqD8'></center></pre></bdo></b><th id='xRqD8'></th></span></q></dt></tr></i><div id='xRqD8'><tfoot id='xRqD8'></tfoot><dl id='xRqD8'><fieldset id='xRqD8'></fieldset></dl></div>

      <small id='xRqD8'></small><noframes id='xRqD8'>

        <bdo id='xRqD8'></bdo><ul id='xRqD8'></ul>

      1. 超出 GC 开销限制

        时间:2023-07-13
      2. <i id='AIiLM'><tr id='AIiLM'><dt id='AIiLM'><q id='AIiLM'><span id='AIiLM'><b id='AIiLM'><form id='AIiLM'><ins id='AIiLM'></ins><ul id='AIiLM'></ul><sub id='AIiLM'></sub></form><legend id='AIiLM'></legend><bdo id='AIiLM'><pre id='AIiLM'><center id='AIiLM'></center></pre></bdo></b><th id='AIiLM'></th></span></q></dt></tr></i><div id='AIiLM'><tfoot id='AIiLM'></tfoot><dl id='AIiLM'><fieldset id='AIiLM'></fieldset></dl></div>
        • <bdo id='AIiLM'></bdo><ul id='AIiLM'></ul>
            <tbody id='AIiLM'></tbody>

          1. <tfoot id='AIiLM'></tfoot>
            • <small id='AIiLM'></small><noframes id='AIiLM'>

                  <legend id='AIiLM'><style id='AIiLM'><dir id='AIiLM'><q id='AIiLM'></q></dir></style></legend>

                  本文介绍了超出 GC 开销限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  JVM 用于抛出java.lang.OutOfMemoryError:GC 开销限制超出"的采样时间是多少?我知道您可以使用参数 GCTimeLimit 和 GCHeapFreeLimit 控制 98% 和 2%,但是采样时间是多少?

                  What is the sampling time JVM uses to throw 'java.lang.OutOfMemoryError : GC overhead limit exceeded'? I know you can control 98% and 2% with parameters GCTimeLimit and GCHeapFreeLimit but whats the sampling time?

                  推荐答案

                  来自 Java SE 6 HotSpot[tm] 虚拟机垃圾收集调优

                  以下

                  GC 时间过长和 OutOfMemoryError

                  Excessive GC Time and OutOfMemoryError

                  如果太多,并发收集器将抛出 OutOfMemoryError时间花在垃圾收集上:如果超过 98%总时间花在垃圾收集上,不到 2%堆被恢复,OutOfMemoryError 将被抛出.此功能旨在防止应用程序长时间运行一段时间内几乎没有进展,因为堆是太小.如有必要,可以通过添加选项-XX:-UseGCOverheadLimit到命令行.

                  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. 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.

                  该策略与并行收集器中的策略相同,不同之处在于执行并发收集所花费的时间不计入98%的时间限制.换句话说,只有在应用程序停止计入过多的 GC 时间.这样的集合通常是由于并发模式故障或显式收集请求(例如,调用 System.gc()).

                  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. In other words, only collections performed while the application is stopped count toward excessive GC time. Such collections are typically due to a concurrent mode failure or an explicit collection request (e.g., a call to System.gc()).

                  结合下面的一段

                  显式垃圾最常见的用途之一收集发生在 RMI 分布式垃圾收集 (DGC) 中.使用 RMI 的应用程序引用其他虚拟机中的对象.垃圾不能在这些分布式应用程序中收集偶尔收集本地堆,因此 RMI 强制进行完整收集定期.这些收集的频率可以控制与属性.例如,

                  One of the most commonly encountered uses of explicit garbage collection occurs with RMIs distributed garbage collection (DGC). Applications using RMI refer to objects in other virtual machines. Garbage cannot be collected in these distributed applications without occasionally collection the local heap, so RMI forces full collections periodically. 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 指定每小时一次的显式收集,而不是默认的每小时一次分钟.但是,这也可能导致某些对象花费更长的时间被回收.这些属性可以设置为 Long.MAX_VALUE使显式集合之间的时间有效地无限,如果DGC的时效性没有上限活动.

                  -Dsun.rmi.dgc.server.gcInterval=3600000 specifies explicit collection once per hour instead of the default rate of once per minute. 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.

                  似乎意味着确定 98% 的评估期为一分钟,但它可能可以在 Sun 的 JVM 上通过正确的定义进行配置.

                  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.

                  当然,其他解释也是可能的.

                  Of course, other interpretations are possible.

                  这篇关于超出 GC 开销限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在 Java 中,对象何时变得不可访问? 下一篇:Android 中的垃圾收集器

                  相关文章

                  <small id='oMAJJ'></small><noframes id='oMAJJ'>

                    <i id='oMAJJ'><tr id='oMAJJ'><dt id='oMAJJ'><q id='oMAJJ'><span id='oMAJJ'><b id='oMAJJ'><form id='oMAJJ'><ins id='oMAJJ'></ins><ul id='oMAJJ'></ul><sub id='oMAJJ'></sub></form><legend id='oMAJJ'></legend><bdo id='oMAJJ'><pre id='oMAJJ'><center id='oMAJJ'></center></pre></bdo></b><th id='oMAJJ'></th></span></q></dt></tr></i><div id='oMAJJ'><tfoot id='oMAJJ'></tfoot><dl id='oMAJJ'><fieldset id='oMAJJ'></fieldset></dl></div>

                      <bdo id='oMAJJ'></bdo><ul id='oMAJJ'></ul>

                      <legend id='oMAJJ'><style id='oMAJJ'><dir id='oMAJJ'><q id='oMAJJ'></q></dir></style></legend><tfoot id='oMAJJ'></tfoot>