java为什么会发生Permgen OutOfMemory错误?
直到今天,我知道permgen
空间有一些限制,当这个限制用尽时,OutOfMemoryError
就来了,我认为这是正确的,因为我看到了OutOfMemoryError
Permgen空间
但是Inside the Java Virtual Machine引用
The size of the method area need not be fixed. As the Java application runs, the virtual machine can expand and contract the method area to fit the application's needs.
那么,当JVM可以扩展时,为什么会出现错误呢?扩张有限制吗
# 1 楼答案
Method Area
是较大的PermGen
或非堆内存区域的一部分。PermSize
设置修复了PermGen
可以使用的最大内存。由于Method Area
是PermGen
的子部分,只要PermGen
的总体大小保持在规定的限制范围内,它就可以根据需要扩展当
PermGen
空间需求超出指定限制时(例如,由于扩展Method Area
),抛出OutOfMemoryError