IA32 Linux Virtual Memory Map
The IA32 architecture provides a 32-bit virtual address space providing access to 4 gigabytes of virtual memory. Linux divides the available memory as 3 GB for user processes and 1 GB for the kernel. Within the user space the first gigabyte is shared by user program text and data and the upper two gigabytes are used by shared libraries and user stack.
Shared Libraries
It has been observed that executables linked with shared libraries begin to fail with segmentation faults as the size of the user data approaches one gigabyte. This observation is consistent with the expansion of user data space being stopped by the presence of shared library text beginning at virtual address 0x40000000 (1 gigabyte).
Static Libraries
Executables linked with static libraries (-static option for ifc compiler) are able to allocate storage for data approaching three gigabytes before beginning to fail with segmentation faults. It appears that linking with static libraries removes the shared library region from the virtual memory map and allows user data to continue to grow toward the user stack. Actual limit of data storage that can be allocated depends on the size of the program text (with static libraries) and the size of the program stack.
|