Logical Memory Areas

Top  Previous  Next

The memory used by a C program is divided into a number of logical memory areas.

 


Code storage

is used to hold the executable instructions of the program itself, together with some constant data and control information.


Static storage

is used to hold static and external variables, including variables declared at the global level.


Stack storage

is used for auto variables. The stack is also used for function calls and passing parameters. The stack is sometimes referred to as workspace.


Heap storage

is used to hold all variables created by calls on malloc, etc. The run-time library also uses the heap internally for I/O buffers and other things.


User-defined sections

are created and managed by you. They can be defined in a C source program by using the CODE_SECTION and DATA_SECTION pragmas; see section the TI compiler documentation.