Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is permgen included in -Xmx?

Tags:

java

permgen

When I say -Xmx=1024m, does this include permgen i.e -XX:MaxPermSize= is taken from these 1024m or it is separate?

Looking at this I thought that it takes from 1024m, but until now I had believed they were separate.

like image 571
Vikas Madhusudana Avatar asked Nov 03 '10 04:11

Vikas Madhusudana


People also ask

Is PermGen removed in Java 8?

Due to the above problems, PermGen has been completely removed in Java 8. In the place of PermGen, a new feature called Meta Space has been introduced. MetaSpace grows automatically by default. Here, the garbage collection is automatically triggered when the class metadata usage reaches its maximum metaspace size.

Is PermGen part of heap?

Java Memory Model - Permanent Generation Note that Perm Gen is not part of Java Heap memory. Perm Gen is populated by JVM at runtime based on the classes used by the application. Perm Gen also contains Java SE library classes and methods. Perm Gen objects are garbage collected in a full garbage collection.

What is PermGen in Java?

The PermGen area of the Java heap is used to store metadata such as class declarations, methods and object arrays. Therefore, the PermGen size requirements depend on the number of classes and methods as well as their size. Java memory is separated into different regions - Young, Tenured and PermGen.

What is the difference between PermGen and heap?

PermGen stands for Permanent Generation. It is a special type of heap space. It is separate from the main memory (heap). JVM uses PermGen to keep track of loaded class metadata.


2 Answers

Nope, permGen space is in addition to main heap (latter capped via -Xmx on Sun VMs)

like image 56
Nikita Avatar answered Oct 02 '22 19:10

Nikita


Permanent generation is a separate space allocated via -XX:MaxPermSize=. This is in addition to the heap set with -Xmx.

See the diagram at http://www.oracle.com/technetwork/java/gc1-4-2-135950.html#3.%20Sizing%20the%20Generations|outline "3. Sizing the Generations"

This shows the "Total Size" i.e. Xmx does not count the Permanent generation.

And by the way, JDK 1.4 is quite old. Check the JDK 1.6 options and links for an updated view: http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html

like image 30
JoseK Avatar answered Oct 02 '22 18:10

JoseK