/ Java Heap space - HotSpot VM ~ Java EE Support Patterns

8.12.2011

Java Heap space - HotSpot VM

This short article will provide you with a high level overview of the different Java Heap memory spaces of the Sun Java HotSpot VM. This understanding is quite important for any individual involved in production support given how frequent memory problems are observed such as OutOfMemoryError.

Future articles will cover more advanced topics such as the different Java Heap spaces such as Young Gen and Old gen associated to each particular garbage collection policy.

Please feel free to also visit the other posts below for case studies on real production system OutOfMemoryError problems.


HotSpot VM: 3 memory spaces

The JVM HotSpot memory is split between 3 memory spaces:

·         The Java Heap
·         The PermGen (permanent generation) space
·         The Native Heap (C-Heap)


Memory Space
Start-up arguments and tuning
Monitoring strategies
Description
Java Heap
-Xmx (maximum Heap space)

-Xms (minimum Heap size)

EX:
-Xmx1024m
-Xms1024m
- verbose GC
- JMX API
- JConsole
- Other monitoring tools
The Java Heap is storing your primary Java program Class instances.
PermGen
-XX:MaxPermSize (maximum size)

-XX:PermSize
(minimum size)


EX:
-XX:MaxPermSize=512m
-XX:PermSize=256m
- verbose GC
- JMX API
- JConsole
- Other monitoring tools
The Java HotSpot VM permanent generation space is the JVM storage used mainly to store your Java Class objects such as names and method of the Classes, internal JVM objects and other JIT optimization related data.
Native Heap
 (C-Heap)
Not configurable directly.

For a 32-bit VM, the C-Heap capacity = 4 Gig – Java Heap - PermGen

For a 64-bit VM, the C-Heap capacity = Physical server total RAM & virtual memory – Java Heap - PermGen
- Total process size check in Windows and Linux
- pmap command on Solaris & Linux
- svmon command on AIX
The C-Heap is storing objects such as MMAP file, other JVM and third party native code objects.

8 comments:

Thanks for your comment on my post 10 points on Java heap memory , I see you have also summarized the topic quite well.Glad to see Native heap, which is used in conjunction with Memory Mapped file in Java. keep sharing P-H.

Good Article...Nicely explained with out confusing

Is this applicable to java 1.8? i believe there is no perm gen concept with 1.8. kindly clarrify

Hi Skillful,

Not applicable for Java 1.8+. I will update this master article with Java 1.8+ and add details about the Metaspace sizing.

Thanks.

Post a Comment