java 了解元空间大小

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39491325/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 04:24:50  来源:igfitidea点击:

Understanding metaspace size

javagarbage-collectionjava-8jvmjstat

提问by noob

JVM Settings:

JVM 设置:

-Xms8192M
-Xmx8192M
-XX:NewRatio=1
-XX:SurvivorRatio=6
-XX:MetaspaceSize=256M
-XX:MaxMetaspaceSize=512M

Output of jstat is

jstat 的输出是

S0C    S1C    S0U    S1U      EC       EU        OC         OU       MC     MU    CCSC   CCSU   YGC     YGCT    FGC    FGCT     GCT   
524288.0 524288.0  0.0   231108.3 3145728.0 2926008.3 4194304.0   73553.2   58624.0 56981.2 8960.0 8619.0      5    0.684   1      0.235    0.919

output of gccapacity is

gc容量的输出是

NGCMN    NGCMX     NGC     S0C   S1C       EC      OGCMN      OGCMX       OGC         OC       MCMN     MCMX      MC     CCSMN    CCSMX     CCSC    YGC    FGC 
4194304.0 4194304.0 4194304.0 218624.0 208896.0 3766784.0  4194304.0  4194304.0  4194304.0  4194304.0      0.0 1099776.0  59136.0      0.0 1048576.0   8960.0     26     1

In both the above output size of metaspace is around 56M even though minimum metaspaceSize is defined as 256m

在上述两个元空间的输出大小都在 56M 左右,即使最小 metaspaceSize 被定义为 256m

回答by Jade Tang

you need turn off the UseCompressedClassPointerswhich will create a space in metaspace.

你需要关闭UseCompressedClassPointers这将在元空间中创建一个空间。