暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

关于-jdk8 permsize说明

777

一、前言

 在使用Oracle  HotSpot jdk8,配置jdk启动参数PermSize=128m MaxPermSize=512m 时出现下列警告

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0


二、分析

The Permanent Generation (PermGen) space has completely been removed and is replaced by a new space called Metaspace. The consequences of the PermGen removal is that  PermSize and MaxPermSize JVM arguments are ignored and you will see warning similar to the one seen below.

就是说jdk8之前配置的永久区空间PermSize、MaxPermSize参数在jdk8中已经被移除,已被Metaspace(元数据区)替代

元数据区存储在原生(本地)内存

12Mbytes on the 32bit client VM and 16Mbytes on the 32bit server VM with larger sizes on
the 64bit VMs

32位client vm 默认12m

 32位 server vm 默认16m

 64位vm默认没有限制

-XX:MetaspaceSize=<NNN>

Where <NNN> is the initial amount of space(the initial high-water-mark) allocated for class metadata (in bytes) that may induce a garbage collection to unload classes. The amount is approximate. After the high-water-mark is first reached, the next high-water-mark is managed by the garbage collector

元数据区初始空间大小,是个近似值,


-XX:MaxMetaspaceSize=<NNN>

Where <NNN> is the maximum amount of space to be allocated for class metadata (in bytes). This flag can be used to limit the amount of space
allocated for class metadata. This value is approximate. By default there is no limit set.

元数据区最大空间大小,是个近似值,防止无限制分配而影响到此主机上的其他jdk 应用,默认没有限制

     元数据是什么?

是原生(堆外)内存管理器,用于管理类元数据,类被加载后就存储在这个区间,它们的生命周期通常局限于类加载器加载过程:当一个加载器被垃圾回收时,它积累的所有类元数据都会被批量释放。https://wiki.openjdk.java.net/display/HotSpot/Metaspace

(Doc ID 2606715.1)


三、推荐的配置方法


解决措施如下:

-XX:PermSize=384m   -XX:MaxPermSize=1024m

     更改为

 -XX:MetaspaceSize=384m -XX:MaxMetaspaceSize=1024m 

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论