JVM参数

-Xms : JVM初始内存大小。

-Xmx : JVM最大内存大小。

一般会把 -Xms 与 -Xmx 设置为同样大小,以避免每次GC后JVM重新分配内存。比如:  -Xms 2048m -Xmx 2048m 

-Xmn : 设置年轻代内存大小。 整个HEAP大小 = 年轻代 + 老年代 + 持久代.

 

 

 

 

 

虚拟机参数PermSize 与 MaxPermSize 

网上找到的有关PermSize的解释

Permanent Generation (which is “Perm” in PermSize)

The permanent generation is used to hold reflective of the VM itself such as class objects and method objects. These reflective objects are allocated directly into the permanent generation, and it is sized independently from the other generations. Generally, sizing of this generation can be ignored because the default size is adequate. However, programs that load many classes may need a larger permanent generation.

PermSize is additional separate heap space to the -Xmx value set by the user. The section of the heap reserved for the permanent generation holds all of the reflective data for the JVM. You should adjust the size accordingly if your application dynamically load and unload a lot of classes in order to optimize the performance. Basically, he heap stores the objects and the perm gen keeps information about the objects inside of it. Therefore, the larger the heap, the larger the perm gen needs to be.

By default, MaxPermSize will be 32mb for -client and 64mb for -server. However, if you do not set both PermSize and MaxPermSize, the overall heap will not increase unless it is needed. When you set both PermSize and MaxPermSize, for example, 192mb, the extra heap space will get allocated when it startup and will stay allocated.

PermSize 是存放持久代(Permanent Generation)的。

持久代用于存放VM本身的反射,比如类对象还有方法对象。 这些反射对象直接存入持久代与其他的代际独立。一般来说默认的持久代大小就已经够了。但是,对需要加载很多类的的程序来说需要一个较大的持久代空间。

持久代(PermSize)是用户设置的-Xmx之外的堆空间。默认情况下MaxPermSize为32MB(client),64MB(Server)。但是,如果你不同时设置PermSize和MaxPermSize,总的对空间并不会立即分配,除非需要用到。 当你同时设置PermSize与MaxPermSize的话,比如256MB,这部份的堆空间就会在VM启动的时候立即分配。

-XX:MaxPermSize=256m -XX:PermSize=256m 

参考链接

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值