Sunday 20 October 2013

Java Memory Types

Java has only two types of memory when it comes to JVM.

Heap memory and Non-heap memory.

Heap Memory

Class instances and arrays are stored in heap memory. Heap memory is also called as shared memory. As this is the place where multiple threads will share the same data.

Non-heap Memory

It comprises of ‘Method Area’ and other memory required for internal processing. So here the major player is ‘Method Area’.

Method Area

As given in the last line, method area is part of non-heap memory. It stores per-class structures, code for methods and constructors. Per-class structure means run time constants and static fields.


Memory Pool

Memory pools are created by JVM memory managers during run time. Memory pool may belong to either heap or non-heap memory.

Runtime Constant Pool

A run time constant pool is a per-class or per-interface run time representation of the constant_pool table in a class file. Each run time constant pool is allocated from the Java virtual machine’s method
area.
jvm memory

No comments:

Post a Comment