什么是Java中的PermGen-space? 我们的团队遇到了PermGen-space增加的问题,这种增加会最终影响性能。
我想了解PermGen-space是什么以及如何优化其空间使用?
什么是Java中的PermGen-space? 我们的团队遇到了PermGen-space增加的问题,这种增加会最终影响性能。
我想了解PermGen-space是什么以及如何优化其空间使用?
来自 http://java.sun.com/docs/hotspot/gc1.4.2/faq.html (问题7--10)
永久代应该如何设置大小?
永久代用于存放虚拟机本身的反射对象,例如类对象和方法对象。这些反射对象直接分配到永久代,它与其他代独立调整大小。一般情况下,可以忽略此代的大小设置,因为默认大小足够了。但是,加载许多类的程序可能需要更大的永久代。
如何判断永久代是否正在填满?
从1.4.2版本开始,-XX:+PrintGCDetails将打印在每个垃圾收集时收集的堆的所有部分的信息。对于完全收集:
[Full GC [Tenured: 30437K->33739K(280576K),0.7050569 secs] 106231K->33739K(362112K),[Perm : 2919K->2919K(16384K)],0.7052334 sec]
此示例显示在永久代中几乎没有收集任何内容(收集前使用2919K,在收集后使用2919K),永久代的当前大小为16384K。
如何增加永久代大小?
使用命令行选项-XX:MaxPermSize =
我如何知道正在加载或卸载哪些类?
使用命令行选项-XX:+ TraceClassloading和-XX:+ TraceClassUnloading
Start your JVM with
-XX:MaxPermSize=Xm
where X is a number like 128, 256.
这是关于该错误的一个很好的链接
。基本上,Perm代表堆空间中存储所有已加载类的空间。它专门用于存储类定义。
除了Java类的基本字段外,还有其他字段。
* Methods of a class (including the bytecodes)
* Names of the classes (in the form of an object that points to a string also in the permanent generation)
* Constant pool information (data read from the class file, see chapter 4 of the JVM specification for all the details).
* Object arrays and type arrays associated with a class (e.g., an object array containing references to methods).
* Internal objects created by the JVM (java/lang/Object or java/lang/exception for instance)
* Information used for optimization by the compilers (JITs)
点击这里。