HP-UX 11i June 2001 Release Notes

Programming
Libraries
Chapter 13258
Header Files
Header files ftw.h and stdio.h were patched to enable C++ large files
support.
In addition, numerous defects were fixed.
New Environment Variables for malloc
libc uses a single lock in the malloc() routines to make them
thread-safe. In a multi-threaded application, there could be contention
on this single lock if multiple threads are calling malloc and free at the
same time. This patch provides multiple arenas, where malloc() can
allocate space from, and a lock for each arena. Threads are distributed
among the arenas. Two new environment variables are introduced:
_M_ARENA_OPTS
_M_SBA_OPTS
_M_ARENA_OPTS
These can be used to tune the number of arenas and the arena expansion
factor for threaded applications. In general, the more threads in an
application, the more arenas should be used for better performance.
Expansion factors control the number of pages to expand each time and
assumes the page size is 4096 bytes. The number of arenas can be from 4
to 64 for threaded applications.
For non-threaded applications, only one arena is used regardless of
whether this environment variable is set or not. However, you still can
use this environment variable to change the expansion factor for
non-threaded applications.
If the environment variable is not set, or the number of arenas is set to
be out of the range, the default number of 8 is used. The expansion factor
is from 1 to 4096; the default value is 32. Again, if the factor is out of the
range, the default value will be used. For example:
$ export _M_ARENA_OPTS=8:32
where the number of arenas is 8, and the expansion size is 32*4096
bytes. In general, the more arenas you use, the smaller the expansion
factor should be, and vice versa.
_M_SBA_OPTS turns on the small block allocator, and sets up parameters
for the small block allocator, namely, maxfast, grain,
num_smallblocks. Refer to mallopt() for details about the small block
allocator, and its parameters. Applications with a small block allocator