I am using Jconsole for monitoring a Java Application. The memory tab shows different Heap and Non Heap memories like
- Heap Memory Usage
- Non Heap Memory Usage
- Memory Pool "CMS Old Gen"
- Memory Pool "Par Eden Space"
- Memory Pool "Par Survivor Space"
- Memory Pool "Code Cache"
- Memory Pool "CMS Perm Gen"
What is the difference between these terms. Also please provide some information regarding - how to find anomalies in the application behavior by monitoring these parameters.
There are essentially three categories of storage in all C-based languages (and most other languages):
- Heap
- Stack
- Static (with several variations)
Heap you're familiar with.
Stack you're also familiar with, but you just don't know it. When you have a method with "local" variables, those variables are allocated in a "invocation frame". The "invocation frame" is allocated when you call the method and deleted when you return from the method, and hence it's most efficiently implemented using a "stack" that grows with call and shrinks with return.
Static is stuff that you don't explicitly allocate and essentially exists from the time program execution begins.
The space required for stack is generally fairly small and is lumped in with "Non Heap Memory" in the categories above.
Non-heap memory is all the memory the JVM allocated for purposes other than the heap. This includes:
- the call stacks (as you noted);
- memory allocated by native code (e.g. for off-heap caching);
- in HotSpot 8, the Metaspace (replacement for the Permanent Generation);
- memory used by the JIT compiler (compiled native code).
In your list, "CMS Old Gen", "Par Eden Space", "Par Survivor Space", and "CMS Perm Gen", all refer to various sections of the heap.
Please follow the links http://www.yourkit.com/docs/kb/sizes.jsp and http://publib.boulder.ibm.com/infocenter/javasdk/v5r0/index.jsp?topic=%2Fcom.ibm.java.doc.diagnostics.50%2Fdiag%2Fproblem_determination%2Faix_mem_heaps.html
Non-Heap
Also, the JVM has memory other than the heap, referred to as non-heap memory. It is created at the JVM startup and stores per-class structures such as runtime constant pool, field and method data, and the code for methods and constructors, as well as interned Strings.
Unfortunately, the only information JVM provides on non-heap memory is its overall size. No detailed information on non-heap memory content is available.
The abnormal growth of non-heap memory size may indicate a potential problem, in this case you may check up the following:
If there are class loading issues such as leaked loaders. In this case, the problem may be solved with the help of Class loaders view.
If there are strings being massively interned. For detection of such problem, Object allocation recording may be used.