Current Convention

Program's written in the C programming language use the following memory layout. At the top of this address space (near 0x00000000), a program's instructions are stored in the 'text' area, its data in the 'data' area, and memory allocated by the program is stored in the dyanmic heap, which grows ?downwards? in memory (towards 0xFFFFFFFF). At the bottom of this address space (near 0xFFFFFFFF), a program's state is stored in the program's 'runtime stack' or 'call stack', which grows ?upwards? in memory (towards 0x00000000). When a program passes execution to a subroutine (i.e., procedure, function, method, etc), a new 'stack frame' is added to the stack that contains parameters that will be passed, space for a return value, and space for local variables to be saved. If a program calls too many subroutines, for example, if a recursive function doesn't terminate, theoretically the stack could grow too big and encounter the data segment. Practically, such a process will be terminated with a stack error once it passes a preset limit.

References