Content deleted Content added
mNo edit summary |
mNo edit summary |
||
Line 12:
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]]''' also known as '''[[.bss|Uninitialized data
*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.
*The '''[[Stack (data structure)|stack]]''' is a [[LIFO (computing)|LIFO]] structure, typically located in the higher parts of memory. It usually "grows down" with every register, immediate value or stack frame being added to it. A stack frame consists at minimum of a return address.
|