Reputation: 8653
Till today, I knew permgen
space has some limit and when this limit is exhausted, OutOfMemoryError
comes, and I think this is correct because I have seen OutOfMemoryError
Permgen space.
But Inside the Java Virtual Machine quotes,
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.
So, when JVM can expand, why the error comes? Is there any limit for expansion?
Upvotes: 3
Views: 114
Reputation: 17923
The Method Area
is part of larger PermGen
or Non-Heap memory area. The PermSize
setting fixes the maximum memory the the PermGen
can use. Since Method Area
is a subpart of PermGen
, it can expand as needed as long as the overall PermGen
size remains withing specified limit.
The moment, PermGen
space requirement goes beyond the specified limit, (say because of expanding Method Area
), OutOfMemoryError
is thrown.
Upvotes: 3