/ 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.

4 comments:

Thanks for the detailed information. and also most of the times both 32 bit and 64 bit works as these expect in some cases where if there are any machine specific calls are called. 32 bit takes 4 bytes long,64 bit takes 8 bytes of size, so 32 bit takes less size compared to 64 bit machines.
To find out the 32 bit or 64 bit 32 bit or 64 bit

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.

Thanks!!!!!!!! nice article

Post a Comment