152 POWER7 and POWER7+ Optimization and Tuning Guide
Introduction
There is a simple methodology on AIX to collect useful information about how an application
uses the C heap. That information can then be used to choose and tune the appropriate
malloc settings. The type of information that typically must be collected is:
The distribution of malloc allocation sizes that are used by an application, which shows if
AIX MALLOCOPTIONS, such as pool and buckets, are expected to perform well. This
information can be used to fine-tune bucket sizes.
The steady state size of the heap, which shows how to size the pool option.
Additional information about thread counts, malloc usage per thread, and so on, can be
useful, but the information that is presented here presents a basic view.
How to collect malloc usage information
To discover the distribution of allocation sizes, set the following environment variable:
export MALLOCOPTIONS=buckets,bucket_statistics:stdout
Run an application. When the application completes, a summary of the malloc activity is
output. Example A-1 shows a sample output from a simple test program.
Example A-1 Output from a simple test program
==================================
Malloc buckets statistical summary
==================================
Configuration values:
Number of buckets: 16
Bucket sizing factor: 32
Blocks per bucket: 1024
Allocation request totals:
Buckets allocator: 118870654
Default allocator: 343383
Total for process: 119214037
Allocation requests by bucket
Bucket Maximum Number of
Number Block Size Allocations
----- ---------- -----------
0 32 104906782
1 64 9658271
2 96 1838903
3 128 880723
4 160 300990
5 192 422310
6 224 143923
7 256 126939
8 288 157459
9 320 72162
10 352 87108
11 384 56136
12 416 63137
13 448 66160
14 480 45571