Differences between version 8 and predecessor to the previous major change of MemoryMap.
Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History
Newer page: | version 8 | Last edited on Sunday, November 14, 2004 12:20:47 pm | by AristotlePagaltzis | Revert |
Older page: | version 3 | Last edited on Friday, November 28, 2003 6:02:02 pm | by JohnMcPherson | Revert |
@@ -1,18 +1,20 @@
-The Linux Virtual Memory
Map (as seen by a userspace
program)
+The [
Linux] VirtualMemory
Map (as seen by a UserSpace
program)
| __Starts at__ | __Contains__
| ffffffff |< End of the universe
+| ffffe000 |< vsyscall table (new in 2.5.x)
| c0000000 |< Off limits, reserved for the kernel
-| xxxxxxxx
|< Process stack (grows down)
+| bfffffff
|< Process stack (grows down)
| bffff000 |< Process heap (grows up)
| 40000000 |< Libraries
| zzzzzzzz |< Unused
-| yyyyyyyy |< __.bss__ segment
, uninitialised program data
+| yyyyyyyy |< __.bss__, uninitialised program data
| xxxxxxxx |< __.data__ segment, initialised program data
| 08048000 |< __.text__ segment, program code
-| 00000000 |< Unmapped to trap NULL pointers
+| 00000000 |< Unmapped to trap [
NULL]
pointers
+"BSS" means __b__lock __s__tarted by __s__ymbol and is a segment of uninitialised that is only stored in the BinaryExecutable image as a length and offset, since it would otherwise waste space. The "text" segment on the other hand contains ''initialized'' global variables and ''is'' stored in the BinaryExecutable.
!!Practical examples
!Library-mapped memory (using ldd(1))
$ ldd /bin/ls
@@ -44,7 +46,11 @@
$ cat > x3.c
#include <stdio.h>
#include <stdlib.h>
- int main(void) {char *p=malloc(3);printf("%p\n", p); return ;}
+ int main(void) {char *p=!
malloc(3);printf("%p\n", p); return ;}
$ gcc -o x3 x3.c && ./x3
0x8049628
+
+Also,
+ cat /proc/''pid''/maps
+gives you the memory map for a program :)