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

  • <small id='l5iGX'></small><noframes id='l5iGX'>

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

        Java 8 中的 MetaSpace 有什么用?

        时间:2023-07-12
          <bdo id='IavLg'></bdo><ul id='IavLg'></ul>

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

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

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

                  本文介绍了Java 8 中的 MetaSpace 有什么用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我知道他们在 Java 8 中已将 PermGen 替换为 MetaSpace.但我有几个问题:

                  I know they have replaced PermGen with MetaSpace in Java 8. But I have few questions:

                  1. MetaSpace默认是GC收集的吗?
                  2. 连PermGen都是GC收集的,加了-XX:+CMSClassUnloadingEnabled之类的args,那MetaSpace有什么比PermGen更好的地方呢?
                  3. MetaSpace 是基于本地内存的,所以它会将 java 对象保存在磁盘上而不是 VM 上?
                  4. 即使 MetaSpace 也会耗尽内存?如果再次这样,我会得到 OutOfMemoryException.
                  5. 默认情况下,MetaSpace 可以随着内存的增加而增长?
                  1. Is MetaSpace by default is GC collected?
                  2. Even the PermGen is GC collected by adding the args like -XX:+CMSClassUnloadingEnabled, then what makes MetaSpace better than PermGen?
                  3. MetaSpace is based on native memory, so it keeps the java objects on the disks rather than on VM?
                  4. Even MetaSpace can run out of memory? If so again I will get OutOfMemoryException.
                  5. By default the MetaSpace can grow on increase in memory?

                  提前致谢

                  推荐答案

                  MetaSpace默认是GC收集的吗?

                  Is MetaSpace by default is GC collected?

                  是的,当元空间满时,GC 会在元空间上运行,它也会动态增加(允许)分配给的内存元数据.

                  Yes, GC will run on metaspace when its getting full, it would also dynamically increase (given its allowed to) the memory allocated for metadata.

                  连PermGen都加了-XX:+CMSClassUnloadingEnabled这样的args被GC收集了,那MetaSpace有什么比PermGen更好的地方呢?

                  Even the PermGen is GC collected by adding the args like -XX:+CMSClassUnloadingEnabled, then what makes MetaSpace better than PermGen?

                  改进之处在于元空间的动态扩展是 permgen 无法做到的.

                  The improvement is with the dynamic expansion of the metaspace which is something permgen wasn't able to do.

                  MetaSpace 是基于本地内存的,所以它会将 java 对象保存在磁盘上而不是 VM 上?

                  MetaSpace is based on native memory, so it keeps the java objects on the disks rather than on VM?

                  根据元空间的描述,它只使用原生内存(没有分页).

                  Based on the description of metaspace, it only uses the native memory (no paging).

                  基于 Pierre - Hugues Charbonneau 的研究(链接在这里),很明显,元空间的引入并不一定能解决 OOM 问题,它充其量只是解决问题的方法,它试图动态调整元空间内存的大小以适应越来越多的类加载可能的副作用不受控制的增长(只要本机内存允许).

                  Based on the research by Pierre - Hugues Charbonneau (link here), it's clear that the introduction of metaspace doesn't necessarily solve the OOM issue, it's a bandaid to the problem at best, it attempts to dynamically resize the metaspace memory to accomodate the growing number of classes which get loaded with a possible side effect of growing uncontrollably (so long as the native memory permits it).

                  我们可以通过将 MaxMetaspaceSize 参数设置为 JVM 并运行提供的示例程序来实现著名的 OOM 错误.

                  We can achieve the famed OOM error by setting the MaxMetaspaceSize argument to JVM and running the sample program provided.

                  非常感谢 Pierre - Hugues Charbonneau.

                  many thanks to Pierre - Hugues Charbonneau.

                  这篇关于Java 8 中的 MetaSpace 有什么用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Java 非常大的堆大小 下一篇:如何减少java并发模式失败和过多gc

                  相关文章

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

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

                  1. <tfoot id='oxUkG'></tfoot>

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