Debugging Dynamic Memory Usage Errors Using HP WDB (5900-1474; WDB 6.2; January 2011)
NOTE:
• The info heap arenas and info heap process commands are not supported
in batch mode.
• The info heap process and info heap arenas are available only on HP-UX
11i v3.
• The stack trace is displayed only if memory debugging is enabled. (Enable the set
heap-check on command to enable memory debugging). If the stack trace is not
required, the memory-usage statistics can be viewed without enabling memory
checking.
Analyzing the info heap process output
The info heap process command displays the number of used, free, small, holding,
node and regular (ordinary) blocks.
If there are a larger number of free small blocks, you can suspect heap-fragmentation.
The application does not differentiate between a small block and an ordinary block.
However, you can tune malloc() to use a specific ratio of small and ordinary blocks
and reduce heap-fragmentation.
The holding block headers and node blocks are used for the internal data-structure and
bookkeeping in malloc(). The sum of the total bytes in holding block headers and
node blocks determines the efficiency of malloc(). The memory allocator is more
efficient when it uses less memory for the internal data-structure and bookkeeping.
Following is a sample output of the info heap process command:
(gdb) info heap process
Total space in arenas: 4657088
Number of bytes in free small blocks: 69216
Number of bytes in used small blocks: 199584
Number of bytes in free ordinary blocks: 2480
Number of bytes in used ordinary blocks: 4375600
Number of bytes in holding block header: 912
Number of small blocks: 3500
Number of ordinary blocks: 9
Number of holding blocks: 0
Number of free ordinary blocks: 1
Number of free small blocks: 388
Small block allocator parameters
enabled: 1
maxfast: 512
numblks: 100
grain: 16
cache
enabled: 0
miss: 0
22