04. Stack and Heap Memory
A simple comparison
Last updated
A simple comparison
Last updated
Stack Memory | Heap Memory |
Generally, memory is automatically managed by program. | Generally, memory management to be done by programmer. |
Traditionally used to stores temporary variables created by each function. | Variables created on the heap are accessible by any function, anywhere in program. |
Limit on stack memory size. | No specific limit on heap memory size. |
Self cleaning memory. | Memory cleanup required explicitly. |