Home

stackminne

Stackminne, or stack memory, is the region of a program’s address space used to store activation records for function calls. Each time a function is invoked, a new stack frame is created containing the return address, saved registers, function parameters, and local automatic variables. Frames are pushed onto the stack on entry and popped on return, following a last-in, first-out (LIFO) discipline.

In most systems the stack is per thread and grows in a direction determined by the architecture;

Stack size is finite and can be exhausted. Large or deeply nested local allocations, heavy use of

Contents of a stack frame commonly include the return address, saved callee-saved registers, function parameters that

many
commonly
used
architectures
have
stacks
that
grow
downward
toward
lower
memory
addresses,
while
others
grow
upward.
The
stack
is
typically
very
fast
to
access
and
is
managed
automatically
by
the
compiler
and
runtime,
with
a
prologue
saving
state
and
an
epilogue
restoring
it.
recursion,
or
large
variadic
parameter
handling
can
lead
to
stack
overflow.
Operating
systems
may
implement
guard
pages
or
other
protections
to
detect
overflow,
and
some
languages
or
runtimes
use
techniques
such
as
stack
canaries
or
shadow
stacks
to
improve
security
against
certain
exploits.
were
passed
on
the
stack,
and
space
for
local
variables
and
temporaries.
In
languages
with
managed
runtimes,
the
stack
may
also
hold
frames
for
the
language
runtime,
while
large
data
is
typically
allocated
on
the
heap.
Stack
usage
is
a
key
factor
in
performance
and
reliability,
influencing
recursion
limits
and
memory
safety
strategies.