Heap Space

  • For objects and data structures with longer lifespan.
  • It is a dynamic memory pool provided by the OS which can be allocated and deallocated by the programs. Therefore, the applications have control of the heap memory. It is not managed by OS.
  • Not Thread-specific. All threads can access it => Not as safe as Stack Space
  • Heap memory can lead to memory leaks.
  • Bigger than Stack Space
  • Can have Manual Memory Management or Implicit Memory Management depending upon the implementation. But even an implicit memory management strategy needs to have an entity (Garbage collection) cleaning up the data.
  • Prone to Memory Leaks