HP-UX 11i Version 1.5 Release Notes, September 2001

Programming
Changes to libc
Chapter 7 97
HUGE_VALL (defined to be +infinity in <math.h>), with the appropriate
sign. This follows the ISO/IEC C99 specification, and is analogous to
strtod(), which returns HUGE_VAL (also equal to +infinity), with the
appropriate sign. On HP-UX 11.0 and 11i, strtold() for overflow cases
returns _LDBL_MAX or _LDBL_NMAX (defined in <values.h>), depending
on the sign of the value; these are the largest-magnitude finite long
double values.
All the HP-UX 11i Version 1.5 (B.11.20) *cvt functions (double, extended,
and long double) treat NaNs and infinities the same way, and that way is
consistent with the HP-UX 11i double [efg]cvt functions: they return ++
and -- for +infinity and -infinity, and they return [-]? for NaNs. On
HP-UX 11i, the long double _ld[efg]cvt functions return +INFINITY and
-INFINITY for +infinity and -infinity, and they return [-]NaN for NaNs.
New Environment Variables and Defaults for malloc()
In earlier versions of libc on PA, libc used 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. On HP-UX 11i Version 1.5
(B.11.20), libc 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 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 1 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