Data segment: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 11:
In detail:
*The '''Data''' area contains constants used by the program that are not initialized to zero. For instance the string defined by <code>char s[] = "hello world";</code> in C would exist in the data part.
*The '''[[.bss|BSS segment]]'''] starts at the end of the data segment and contains all global variables that are initialized to zero. 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 data 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]] 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.