Heap memory is a part of memory allocated to JVM, which is shared by all executing threads in the application. It is the part of JVM in which all class instances and are allocated. It is created on the Start-up process of JVM. It does not need to be contiguous, and its size can be static or dynamic. Space allocated to the memory is reclaimed through an automatic memory management process called garbage collection. Heap memory is a shared area that is utilized during the runtime of Java applications. It is created during the instantiation of Java Virtual Machine (JVM).
This memory is shared by instances of all the classes created during the runtime of an application. As per system configuration, the size of heap memory may be fixed or variable. In order to reclaim the space of heap memory, an automatic memory management process called garbage collection is triggered by JVM. JVM provides control to developers to vary the size of heap memory according to requirement.