正在加载图片...
Both global and static variables have a single instance that persists throughout life of program and the usual implementation for these is a collection of memory locations in the global/static data segment of the executable.These locations are fixed at the end of the compilation process. Local variables only come into existence on entry to a routine and persist until its exit.To handle these we use a runtime stack that holds the values of locals.The area of memory used to hold all the locals of a routine is called the stack frame(active record).The stack frame for the routine currently executing will be on top of the stack. Dynamic allocation of further storage during the run of a program is done by calling library functions (e.g.,malloc()).This storage is obtained from memory in a different segment than the program code, global/static,or stack.Such memory is called the heap. Both global and static variables have a single instance that persists throughout life of program and the usual implementation for these is a collection of memory locations in the global/static data segment of the executable. These locations are fixed at the end of the compilation process. Local variables only come into existence on entry to a routine and persist until its exit. To handle these we use a runtime stack that holds the values of locals. The area of memory used to hold all the locals of a routine is called the stack frame(active record). The stack frame for the routine currently executing will be on top of the stack. Dynamic allocation of further storage during the run of a program is done by calling library functions (e.g., malloc()). This storage is obtained from memory in a different segment than the program code, global/static, or stack. Such memory is called the heap
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有