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

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

    • <bdo id='CUfw9'></bdo><ul id='CUfw9'></ul>
    <legend id='CUfw9'><style id='CUfw9'><dir id='CUfw9'><q id='CUfw9'></q></dir></style></legend>

    <tfoot id='CUfw9'></tfoot>

      JVM 标志 CMSClassUnloadingEnabled 实际上是做什么的?

      What does JVM flag CMSClassUnloadingEnabled actually do?(JVM 标志 CMSClassUnloadingEnabled 实际上是做什么的?)
          <tbody id='wRtRA'></tbody>

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

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

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

                本文介绍了JVM 标志 CMSClassUnloadingEnabled 实际上是做什么的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                除了一些非常模糊的高级定义,例如摆脱你的 PermGen 问题"(它没有,顺便说一句).

                I cannot for the life of me find a definition of what the Java VM flag CMSClassUnloadingEnabled actually does, other than some very fuzzy high-level definitions such as "gets rid of your PermGen problems" (which it doesn't, btw).

                我查看了 Sun/Oracle 的网站,甚至查看了 选项列表 实际上并没有说明它的作用.

                I have looked on Sun's/Oracle's site, and even the options list doesn't actually say what it does.

                根据标志的名称,我猜测 CMS 垃圾收集器默认情况下不会卸载类,并且此标志将其打开 - 但我不能确定.

                Based upon the name of the flag, I'm guessing that the CMS Garbage Collector doesn't by default unload classes, and this flag turns it on - but I can't be sure.

                推荐答案

                更新 此答案与 Java 5-7 相关,Java 8 已修复此问题:https://blogs.oracle.com/poonam/about-g1-garbage-collector,-permanent-generation-and-metaspace 感谢 mt.uulu

                Update This answer is relevant for Java 5-7, Java 8 has this fixed: https://blogs.oracle.com/poonam/about-g1-garbage-collector,-permanent-generation-and-metaspace Kudos go to mt.uulu

                对于 Java 5-7:

                For Java 5-7:

                Oracle/Sun VM 对世界的标准看法是:类是永恒的.所以一旦加载,即使没有人关心,它们也会留在内存中.这通常没有问题,因为您没有那么多纯粹的设置"类(= 一次用于设置,然后不再使用).所以即使它们占用 1MB,谁在乎呢.

                The standard Oracle/Sun VM look on the world is: Classes are forever. So once loaded, they stay in memory even if no one cares anymore. This usually is no problem since you don't have that many purely "setup" classes (= used once for setup and then never again). So even if they take up 1MB, who cares.

                但最近,我们有了像 Groovy 这样的语言,它们在运行时定义类.每次运行脚本时,都会创建一个(或多个)新类,并且它们会永远保留在 PermGen 中.如果您正在运行服务器,则意味着您有内存泄漏.

                But lately, we have languages like Groovy, that define classes at runtime. Every time you run a script, one (or more) new classes are created and they stay in PermGen forever. If you're running a server, that means you have a memory leak.

                如果启用 CMSClassUnloadingEnabled,GC 也会扫描 PermGen,并删除不再使用的类.

                If you enable CMSClassUnloadingEnabled the GC will sweep PermGen, too, and remove classes which are no longer used.

                您还必须启用 UseConcMarkSweepGC(感谢 山姆·哈斯勒).看到这个答案:https://stackoverflow.com/a/3720052/2541

                You will also have to enable UseConcMarkSweepGC (thanks to Sam Hasler). See this answer: https://stackoverflow.com/a/3720052/2541

                这篇关于JVM 标志 CMSClassUnloadingEnabled 实际上是做什么的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Bytecode features not available in the Java language(Java 语言中不可用的字节码功能)
                ClassCastException because of classloaders?(ClassCastException 因为类加载器?)
                How can I add a Javaagent to a JVM without stopping the JVM?(如何在不停止 JVM 的情况下将 Javaagent 添加到 JVM?)
                Cannot load 64-bit SWT libraries on 32-bit JVM ( replacing SWT file )(无法在 32 位 JVM 上加载 64 位 SWT 库(替换 SWT 文件))
                Encourage the JVM to GC rather than grow the heap?(鼓励 JVM 进行 GC 而不是增加堆?)
                Why a sawtooth shaped graph?(为什么是锯齿形图形?)
                <legend id='uCH2E'><style id='uCH2E'><dir id='uCH2E'><q id='uCH2E'></q></dir></style></legend>

                  <tbody id='uCH2E'></tbody>

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

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

                      1. <tfoot id='uCH2E'></tfoot>
                          <bdo id='uCH2E'></bdo><ul id='uCH2E'></ul>