Content deleted Content added
mNo edit summary |
mNo edit summary |
||
Line 11:
In detail:
*The '''Data''' area contains global variables used by the program that are not initialized to zero. This segment can be further classified into initialized read-only area and initialized read-write area. For instance the string defined by <code>char s[] = "hello world";</code> in C and a C statement like <code>int debug=1;</code> outside the main would be stored in initialized read-write area. And a C statement like <code>char *string = "hello world";</code> makes the string literal <code>"hello world"</code> to be stored in initialized read-only area and the character pointer variable <code>string</code> in initialized read-write area.
*The '''[[.bss|BSS segment]]''' starts at the end of the data segment and contains all global and static variables that are initialized to zero by default. For instance a variable declared <code>static int i;</code> would be contained in the BSS segment.
*The '''[[heap area]]''' begins at the end of the '''[[.bss|BSS segment]]''' and grows to larger addresses from there. The Heap area is managed by [[malloc]], realloc, and free, which use the brk and sbrk system calls to adjust its size. The Heap area is shared by all shared libraries and dynamic load modules in a process.
|