'Shared Object Memory' vs 'Heap Memory' - Java
What is difference between 'Shared Object Memory' and 'Heap Memory' in Java. Is it like 'Shared Object Memory' is superset of 'Heap Memory'?
The source of this question is documentation of jmap. It provides different options to Print 'Shared O开发者_开发问答bject Memory' and 'Heap Memory'.
Java memory (up to Java 8) consists of 3 parts:
- Heap memory.
- Non-heap memory (PermGen).
- Other memory (JVM own structures).
Memory for all class instances is allocated from the heap. Non-heap memory is primarily used by ClassLoaders to store class-related data.
Some details about shared objects are here: what is shared objects file?.
From my analysis so far:
The default option would print all the memory information including:
- Heap Memory
- Perm Gen
- Other Memory (including JNI, Stack space, etc)
This analysis if on the basis of followings:
In JDK docs it is mentioned that the default options (which is 'Shared Object Memory') is similar to pmap command of Solaris. Looking at pmap command, it seems it prints the complete memory information.
Please add comments to validate this understanding.
Shared object memory is where frequently accessed classes of java library are memory mapped so that they can be loaded faster than loading from rt.jar. This includes many commonly used classes like Comparable
, String
, Object
etc. If a requested class file is not available in shared object memory, it is requested from rt.jar. It can be thought of as caching frequently used classes in various java programs.
精彩评论