This is created by JVM while its boostratp time. All class instances are created up on heap memory and memory management is governed by garbage collector (GC) . Heap memory size can be configured and that can be static or dynamic as developer needed.

Java heap memory can be differentiate such as young and old memory areas. Newly created objects are saving young memory. Application level long running objects are saved old memory.

If we take heap in C or C++ heap does not clean automatically. Developer explicitily need to apply deallocation of perticulat memory.

Advantages

01. Develop can use it until it destroy by himself

02. When we allocate size we can set the actual value runtime.

Disadvantages

01. Heap can be causes buggy and even from Java GC make the program slower.

References

https://opendsa-server.cs.vt.edu/ODSA/Books/CS2/html/HeapMem.html

Leave a Reply