Sunday, May 23, 2004

Stack

I thought I had a clear idea about the Stack memory, but something popped in my head and now I'm confused. So hopefully you can clarify this.

"The static storage area is simply a fixed patch of memory that is allocated before the program begins to run. Using the stack or static storage area places a priority on the speed of storage allocation and release, which can be valuable in some situations."

What does "allocated before the program is run" mean exactly? Does it just mean that the OS "reserves" some area of memory and uses that as a stack (keep pushing on the function calls etc... in this area) in a FILO manner? Whereas the heap is just another chunk but you are free to allocate anywhere.

When the compiler compiles your C++ code, it generates native machine code right? Does the obj file only contain those instrutions?

No comments: