- Unsupervised Learning
- Posts
- The Difference Between Stack and Heap Based Memory
The Difference Between Stack and Heap Based Memory
There are many long explanations of heap vs. stack memory. This is a short one.
The Stack is the temporary memory where variables are stored while a function is executing. When the function finishes, the memory is cleared automatically.
The Heap is memory that the programmer can use for the application in a more manual way. You have to allocate memory, use it, and then free it up afterwords all by hand.
Notes
This mostly pertains to C and C++. There are some differences in some of the more modern programming languages, but in the world of information security this is still pertinent because of the lasting prevalence of buffer overflows in C-based languages.
CREATED: DECEMBER 2016