What's the purpose of the extra virtual memory overhead for 64-bit libraries?
I noticed that every 64-bit library reserves either 1 or 2 MB of virtual memory. Here's an example snipped of "pmap <pid>" output (the interesting line has permissions "-----"):
0000003341800000 532K r-x-- /lib64/tls/libm-2.3.4.so 0000003341885000 1020K ----- /lib64/tls/libm-2.3.4.so 0000003341984000 4K r---- /lib64/tls/libm-2.3.4.so 0000003341985000 4K rw--- /lib64/tls/libm-2.3.4.so 32-bit libraries do not have this overhead. This memory does not seem to be backed by physical RAM (VmRSS number in /proc/<pid>/status is too small to include these overheads) and hence doesn't seem to be a problem. I'm still curious what that extra space is for. Does anybody know? In case this matters, I'm using CentOS 4.6 with kernel 2.6.9-67 on x86-64 CPU. Thank you. |
Could you post output of
Code:
readelf -l /lib64/tls/libm-2.3.4.so |
<Didn't use CODE tags around the output so the post was incomprehensible. Removed it>
|
That came out ugly. Let me try again:
Code:
> readelf -l /lib64/tls/libm-2.3.4.so |
Quote:
1) map ALL PT_LOAD segments at ONCE (with permission of first PT_LOAD segment) 2) walk PT_LOAD segment list and change (with mprotect) segment's permission to correct ones. That include changing 'hole' permissions to 0 PT_LOAD segments alignment on x86_64 is 0x100000. PAGE_SIZE is 0x1000 (Why alignment is 0x100000 is beyond me.) When ld-linux decide where first segment ended it uses PAGE_SIZE. But when linker select virtual address for the second PT_LOAD segments it used alignment (i.e 0x100000) So from the loader's point of view there is a hole between first and second PT_LOAD segment, and you saw it as mapping with '---' permissions. On the x86 both alignment and PAGE_SIZE are 0x1000 so there is no dummy mappings there. |
All times are GMT -5. The time now is 08:13 PM. |