Oct 21, 2010

Heap Memory and stack memory

I have read through several times about the distinction between the heap memory and stack memory. But when I recollect I always mix up 1 or 2 things that are stored there.
Here is the separation and please Alimoor never mix this up again.

Heap memory:
-------------
For dynamic allocation of memory.
1. Global variables
2. Static variables
3. Dynamically allocated memory (vector, queue in c++ or malloc, calloc, realloc in c).


Stack memory:
-------------
1. local variables
2. function parameters
3. function return address
3. LIFO order

Useful links:
vector : pass by value/pass by reference/pass by const reference
Stack/Heap : ee.hawaii.edu
Buffer overflow
C++ new
IBM Mac OS X compilers
Vector(C++)
stackoverflow
Learncpp:Nice article

No comments:

Down with the Dictatorship!

    "Let them hate me, so that they fear me" - Caligula 41AD