Native heap exhaustion can also occur without the Inuse pages approaching
65535 Inuse pages. It can be caused by fragmentation of the AIX® malloc
heaps, which is how AIX handles the native heap of the
JVM.
This kind of OutOfMemory condition can again be identified from
the svmon snapshots. Whereas previously the important column to look
at for a memory leak is the Inuse values, for problems in the AIX malloc
heaps it is important to look at the 'Addr Range' column. The 'Addr
Range' column details the pages that have been allocated, whereas
the Inuse column details the number of pages that are being used (committed).
It is possible that pages that have been allocated have not been
released back to the process when they have been freed. This leads
to the discrepancy between the number of allocated and committed pages.
You have a range of environment variables to change the behavior
of the malloc algorithm itself and thereby solve problems of this
type:
- MALLOCTYPE=3.1
- This option allows the system to move back to an older version
of memory allocation scheme in which memory allocation is done in
powers of 2. The 3.1 Malloc allocator, as opposed to the default algorithm,
frees pages of memory back to the system for reuse. The 3.1 allocation
policy is available for use only with 32-bit applications.
- MALLOCMULTIHEAP=heaps:n,considersize
- By default, the malloc subsystem uses a single heap. MALLOCMULTIHEAP allows
users to enable the use of multiple heaps of memory. Multiple
heaps of memory can lead to memory fragmentation, and so the use of
this environment variable is not recommended
- MALLOCTYPE=buckets
- Malloc buckets provides an optional buckets-based extension of
the default allocator. It is intended to improve malloc performance
for applications that issue large numbers of small allocation requests.
When malloc buckets is enabled, allocation requests that fall inside
a predefined range of block sizes are processed by malloc buckets.
Because of variations in memory requirements and usage, some applications
might not benefit from the memory allocation scheme used by malloc
buckets. Therefore, it is not advisable to enable malloc buckets system-wide.
For optimal performance, enable and configure malloc buckets on a
per-application basis.
Note: The above options might cause a percentage
of performance hit. Also the 3.1 malloc allocator does not support
the Malloc Multiheap and Malloc Buckets options.
- MALLOCBUCKETS= number_of_buckets:128,bucket_sizing_factor:64,blocks_per_bucket:1024:
bucket_statistics: <path name of file for malloc statistics>
- See above.