BSS segment: (BSS segment) refers to a memory area used to store uninitialized global variables in the program. BSS is an English Block
Short for started by symbol. BSS segments belong to static memory allocation.
Data Segment: a data segment is usually a memory area used to store initialized global variables in the program. The data segment belongs to the static memory allocation.
Code segment: A code segment (code segment/Text Segment) is usually a memory area used to store Program Execution Code. The size of this area is determined before the program runs, and the memory area is usually read-only,
Some architectures also allow code segments to be writable, that is, programs can be modified. In the code segment, it may also contain some read-only constant variables, such as string constants.
Heap: a heap is used to store the memory segments dynamically allocated during a process. Its size is not fixed and can be dynamically expanded or reduced. When a process calls functions such as malloc/free to allocate memory, the newly allocated memory is dynamically added to the heap (the heap is expanded) /The released memory is removed from the heap (the heap is reduced)
STACK: A stack is also called a stack. It stores local variables of a program (but does not include static declared variables. Static means to store variables in the data segment ). In addition, when a function is called, the stack is used to pass parameters and return values. Because of the stack's first-in-first-out feature, the stack is particularly convenient for storing/restoring the call site.
Is a typical C memory distribution chart in apue.
From: http://blog.csdn.net/hxg130435477/article/details/8501610