Hire QA – Specialized in QA Recruitment, Technical Interviews and Testing Solutions

What is difference between Heap and Stack Memory?

Category: Java

Heap memory is used by all the parts of the application whereas stack memory is used only by one thread of execution.
 Whenever an object is created, it’s always stored in the Heap space and stack memory contains the reference to it.

Stack memory only contains local primitive variables and reference variables to objects in heap space.
 Memory management in stack is done in LIFO manner whereas it’s more complex in Heap memory because it’s used globally.

Leave a Reply

Your email address will not be published. Required fields are marked *