Stack-based memory allocation

Stack-based memory allocation

Stacks in computing architectures are regions of memory where data is added or removed in a last-in-first-out (LIFO) manner. In most modern computer systems, each thread has a reserved region of memory referred to as its stack. When a function executes, it may add some of its local state data to the top of the stack; when the function exits it is responsible for removing that data from the stack. At a minimum, a thread's stack is used to store the location of a return address provided by the caller in order to allow return statements to return to the correct location.

Comment
enStacks in computing architectures are regions of memory where data is added or removed in a last-in-first-out (LIFO) manner. In most modern computer systems, each thread has a reserved region of memory referred to as its stack. When a function executes, it may add some of its local state data to the top of the stack; when the function exits it is responsible for removing that data from the stack. At a minimum, a thread's stack is used to store the location of a return address provided by the caller in order to allow return statements to return to the correct location.
Depiction
ProgramCallStack2 en.svg
Has abstract
enStacks in computing architectures are regions of memory where data is added or removed in a last-in-first-out (LIFO) manner. In most modern computer systems, each thread has a reserved region of memory referred to as its stack. When a function executes, it may add some of its local state data to the top of the stack; when the function exits it is responsible for removing that data from the stack. At a minimum, a thread's stack is used to store the location of a return address provided by the caller in order to allow return statements to return to the correct location. The stack is often used to store variables of fixed length local to the currently active functions. Programmers may further choose to explicitly use the stack to store local data of variable length. If a region of memory lies on the thread's stack, that memory is said to have been allocated on the stack, i.e. stack-based memory allocation (SBMA). This is contrasted with a heap-based memory allocation (HBMA). The SBMA is often closely coupled with a function call stack.
Is primary topic of
Stack-based memory allocation
Label
enStack-based memory allocation
Link from a Wikipage to another Wikipage
32V
Application binary interface
Automatic variable
C (programming language)
Call stack
Category:Memory management
Crash (computing)
Dynamic memory allocation
File:ProgramCallStack2 en.svg
Gnulib
Heap-based memory allocation
LIFO (computing)
Memory (computers)
Microsoft Windows
MIPS architecture
POSIX
PowerPC
Setjmp.h
Stack (abstract data type)
Stack buffer overflow
Stack machine
Stack overflow
Standard C
Static variable
Thread (computer science)
Unix-like
Variable-length array
X86
SameAs
4vfWf
m.05 t5x
Q7595944
基于堆栈的内存分配
Subject
Category:Memory management
Thumbnail
ProgramCallStack2 en.svg?width=300
WasDerivedFrom
Stack-based memory allocation?oldid=1123167859&ns=0
WikiPageLength
8446
Wikipage page ID
1836265
Wikipage revision ID
1123167859
WikiPageUsesTemplate
Template:Code
Template:More citations needed
Template:Multiple issues
Template:Original research
Template:Other uses
Template:Reflist
Template:Short description