24 July, 2014

JVM Structure & YourKit Tool

As a java programmer, we should have at least basic knowledge of JVM and how it stores values.

The JVM memory consists of the following segments,
  • Heap Memory :  Storage for Java objects
  • Non-Heap Memory : Used by Java to store loaded classes and other meta-data
  • Other :  JVM internal structures, loaded profiler agent code and data, etc.

Heap :
The JVM has a heap that is the runtime data area from which memory for all class instances and arrays are allocated. It is created at the JVM start-up.
The heap size may be configured with the following VM parameters:
  • -Xmx<size> - to set the maximum Java heap size
  • -Xms<size> - to set the initial Java heap size
By default, the maximum heap size is 64 Mb.
Heap memory for objects is occupied by an automatic memory management system which is known as a garbage collector. The heap may be of a fixed size or may be expanded and shrunk, depending on the garbage collector's strategy.

Non-Heap :
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.

Popular Posts

Featured Post

Liferay 7.3 compatibility matrix

Compatibility Matrix Liferay's general policy is to test Liferay Portal CE against newer major releases of operating systems, open s...