admin管理员组文章数量:1642342
VM 的Permanent generation space,实际上就是方法区,存储了下面两种类型的数据:
1.Class的节本信息
Package Name
Super class package name
Class or interface
Type modifiers
Super inferface package name
2.其它信息
The constant pool for the type
Field information
Method information
All class (static) variables declared
in the type, except constants
A reference to class ClassLoader
A reference to class Class
本来SUN设计的时候认为这个区域在JVM启动的时候就固定了,但他没有想到现在动态会用得这么广泛。而且这个区域有特殊的垃圾收回机制,现在的问题是动态加载类到这个区域后,gc根本没办法回收!
现在开发中最常见的错误莫过于Permgen Space!
解决办法:
1,把不必要的 jar 文件清理出 lib;
2,不要频繁地进行 reload;
3,增加 PermGen Space 内存区域,默认是 64MB,可以采用 -XX:MaxPermSize 这个 JVM 参数改这块区域改大一些,这个参数详见:
http://java.sun/javase/technologies/hotspot/vmoptions.jsp
如果用的是 Tomcat 的话,可以在 catalina.bat 开始处增加一行 set JAVA_OPTS=-XX:MaxPermSize=128m
版权声明:本文标题:Java内存管理-Permanent Space 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/xitong/1729334606a1196814.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论