Where are stack and heap located?
I know what they are, and what the do. However, I don''t know where they are located. Since the stack is a more temporary memory area (lets call it that ), does that mean its represents RAM, and the heap would be HD space? Or are they both RAM? Or both HD space? Or are they both HD space? Ok I confused myself.
=======================================
A man with no head is still a man.
A head with no man is plain freaky.
Both the stack and the heap are placed in within memory space; this means that unless they are swapped to disk by your operating system it exists only in RAM. In fact is you just allocate a big piece of memory on the heap and never use it may not even be given any RAM but not exist at all.
Where it exist physically in RAM depends on your virtual adressing table which is hidden from you by your operating system.
If you use Windows the heap and stack (and all other data for that matter - and your code) is placed between the first 4MB and the 2GB of the adress space. It is compiler dependant how it is laid out within this area, but usually the code is placed in one end and after the code the stack begins. In the end of the adress space the heap begins. In some compilers the stack and heap has switched places. They then grow towards each other until they meet in the middle and you then run out of memory.
Jacob Marner
Where it exist physically in RAM depends on your virtual adressing table which is hidden from you by your operating system.
If you use Windows the heap and stack (and all other data for that matter - and your code) is placed between the first 4MB and the 2GB of the adress space. It is compiler dependant how it is laid out within this area, but usually the code is placed in one end and after the code the stack begins. In the end of the adress space the heap begins. In some compilers the stack and heap has switched places. They then grow towards each other until they meet in the middle and you then run out of memory.
Jacob Marner
Jacob Marner, M.Sc.Console Programmer, Deadline Games
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement