java.lang.OutOfMemoryError: PermGen space

PermGen(Permanent Generation) space is reserved for long-term objects - mostly Class objects loaded by the ClassLoader. PermGen will not be garbage collected except under very special circumstances (specifically, when the ClassLoader that loaded those classes goes out of scope). This is a garbage collection optimization - if objects that we don't expect to be garbage collected are stored separately, it compacts the space where the rest of the objects are stored, which leads to less work for the garbage collector.
 
The PermGen is specific to VMs having generational garbage collection. If you use, say, JRockit, the "significance of PermGen" is non-existent because JRockit doesn't have that concept. I think it's important to point out that PermGen are not part of the Java specs and only an implementation detail of (quite) some VMs.   
 
The only thing you really need to know is that PermGen space is separate from the general heap and not affected by the -Xmx VM parameter. To set a new initial size on Sun JVM use the -XX:PermSize=64m option when starting the virtual machine. To set the maximum permanent generation size use -XX:MaxPermSize=128m option. If you set the initial size and maximum size to equal values you may be able to avoid some full garbage collections that may occur if/when the permanent generation needs to be resized. The default values differ from among different versions but for Sun JVMs upper limit is typically 64MB.    
 
Some of the default values for Sun JVMs are listed below. 
 

JDK 1.3.1_06

Initial Size

Maximum Size

Client JVM

1MB

32MB

Server JVM

1MB

64MB

 

JDK 1.4.1_01

Initial Size

Maximum Size

Client JVM

4MB

64MB

Server JVM

4MB

64MB

 

JDK 1.4.2

Initial Size

Maximum Size

Client JVM

4MB

64MB

Server JVM

16MB

64MB

 

JDK 1.5.0

Initial Size

Maximum Size

Client JVM

8MB

64MB

Server JVM

16MB

64MB

 
 

转载于:https://my.oschina.net/coda/blog/40158

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值