The static section is generated by
the compiler and cannot be extended
at run-time. Called the uninitialized
data section in unix's a.out.
The stack. The stack grows and
shrinks during execution, according
to the depth of the call chain.
Infinite recursion often leads to
stack overflow. Large parameters
can also result in the program running
out of stack space.
The heap. When the program makes a
request for more dynamic memory
(by calling malloc, for example),
a suitable chunk of memory is allocated
on the heap.
This is a common organization of memory on Unix systems.
The Text Segment holds the code (instructions)
of the program. The Initialized Data segment
holds strings, etc, that don't change. Static Data
holds global variables. The Stack holds procedure
activation records and the Heap dynamic data.
are stored in
the Static Data area.
An Own variable can only be
referenced from within the procedure
in which it is declared. It retains
its value between procedure calls.
Allocate global variables on the bottom of the
stack. Refer to variables through
the Global Pointer$gp, which
is set to point to the beginning of the stack.
stored
on the stack or in special
argument registers.
Languages that allow recursion cannot store
local variables in the Static Data section.
The reason is that every Procedure Activation
needs its own set of local variables.
For every new procedure activation,
a new set of local variables is created on
the run-time stack. The data stored for a
procedure activation is called an
Activation Record.
Each Activation Record (or (Procedure) Call Frame)
holds the local
variables and actual parameters of a particular
procedure activation.