Java Memory Concepts: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 8: Line 8:


=Non-Heap Memory=
=Non-Heap Memory=
Anything else that is not a class instance or an array is allocated by the JVM in memory areas different from [[#Heap|heap]]. These memory areas are referred collectively as ''non-heap memory''. The non-heap memory include:
* a ''method area''
* thread stack storage area


=Memory Manager=
=Memory Manager=

Revision as of 17:51, 9 May 2017

Internal

Heap

The heap is the runtime data area in the JVM where all class instances and arrays are allocated. The heap is allocated when the JVM starts, and it may be of a fixed or variable size. The objects that are no longer in use are automatically reclaimed by a garbage collector. Metrics reflecting heap usage are exposed by the Memory MBean, which can be obtained from the platform MBean server.

Non-Heap Memory

Anything else that is not a class instance or an array is allocated by the JVM in memory areas different from heap. These memory areas are referred collectively as non-heap memory. The non-heap memory include:

  • a method area
  • thread stack storage area

Memory Manager

Memory Pool

Garbage Collector