HP-UX HB v13.00 Ch-11 - Software Development

HP-UX Handbook Rev 13.00 Page 82 (of 101)
Chapter 11 Software Development
October 29, 2013
:
type space vaddr ref virt phys swap
TEXT 0xb288800.0x0000000000001000 3 5 5 1
DATA 0x15a6400.0x0000000040001000 1 1023 766 1026
MMAP 0x15a6400.0x0000000072b90000 1 13 13 14
:
STACK 0x15a6400.0x000000007dff0000 1 528 272 530
:
$
The DATA line describes the heap. Its start address is given in the vaddr column, and its size in 4k
pages in the virt column. The difference between the start of the first MMAP region and the end
of the heap shows how much is still available:
first MMAP starts at: 0x72b90000
Heap ends at: 0x40001000 + 1023 * 4096 = 0x40400000
----------
Available address space: 0x32790000 (ca. 800 MB)
The same calculation can be done with a core file, from the output of adb’s $m command.
The process stack always starts at (0x80000000 (0xc0000000 for q3p/q4p executables)
maxssiz), and the space up to the quadrant’s end is reserved for the stack. If the stack doesn’t
grow that much, a large maxssiz setting just wastes address space and decreases the available
space for heap and private mappings. It is recommended to reduce it as much as possible, but
since maxssiz is a system wide limit, it is necessary to check the stack requirements of all
processes running on the system.
In the above example, the stack starts at 0x7dff0000 which means maxssiz was set to 32 MB.
On the other hand, the virt column shows the process has 528 pages in use which is only 2 MB,
so this process wastes 30 MB of its address space here.
System V shared memory allocated by shmget(2), shared mappings and shared library text
(which is nothing else but shared mappings) will all reside in the shared quadrants. If an
shmget() fails, check against the SHM related kernel parameters and increase them if required.
If it still fails, or if a shared mapping fails, no more address space is available in the shared
quadrants. The usage of the shared quadrants can be displayed with shminfo.
If a process ran out of address space, either in the shared or private quadrants, the only way out is
to change the quadrant usage from private to shared or vice versa. However, the total amount of
memory available for a 32-bit process is limited to 4 GB, even if the system has plenty of virtual
memory. If 4 GB is not sufficient, the application must be migrated to 64-bit.