Appendix A. Analyzing malloc usage under AIX
153
15 512 44080
Allocation requests by heap
Heap Buckets Default
Number Allocator Allocator
----- ----------- -----------
0 118870654 343383
This environment variable causes the program to produce a histogram of allocation sizes
when it terminates. The number of allocation requests satisfied by the default allocator
indicates the fraction of requests that are too large for the buckets allocator (larger than 512
bytes, in this example). By modifying some of the malloc buckets configuration options, you
can, for example, obtain more details about larger allocation sizes.
To discover the steady state size of the heap, set the following environment variable:
export MALLOCDEBUG=log
Run an application to a steady state point, attach it by running
dbx
, and then run
malloc
.
Example A-2 shows a sample output.
Example A-2 Sample output from the malloc subroutine
(dbx) malloc
The following options are enabled:
Implementation Algorithm........ Default Allocator (Yorktown)
Malloc Log
Stack Depth............. 4
Statistical Report on the Malloc Subsystem:
Heap 0
heap lock held by................ pthread ID 0x20023358
bytes acquired from sbrk()....... 5309664
bytes in the freespace tree...... 334032
bytes held by the user........... 4975632
allocations currently active..... 76102
allocations since process start.. 20999785
The Process Heap
Initial process brk value........ 0x20013850
current process brk value........ 0x214924c0
sbrk()s called by malloc......... 78
The
bytes held by the user
value indicates how much heap space is allocated. By stopping
multiple times when you run
dbx
and then running
malloc
, you can get a good estimate of the
heap space needed by the application.
For more information, see System Memory Allocation Using the malloc Subsystem,
available at:
http://publib.boulder.ibm.com/infocenter/aix/v7r1/topic/com.ibm.aix.genprogc/doc/g
enprogc/sys_mem_alloc.htm
Summary of Contents for Power System POWER7 Series
Page 2: ......
Page 36: ...20 POWER7 and POWER7 Optimization and Tuning Guide...
Page 70: ...54 POWER7 and POWER7 Optimization and Tuning Guide...
Page 112: ...96 POWER7 and POWER7 Optimization and Tuning Guide...
Page 140: ...124 POWER7 and POWER7 Optimization and Tuning Guide...
Page 162: ...146 POWER7 and POWER7 Optimization and Tuning Guide...
Page 170: ...154 POWER7 and POWER7 Optimization and Tuning Guide...
Page 223: ......