HP-UX 11i June 2002 Release Notes

Programming
Libraries
Chapter 15
262
The malloc() per-thread cache is a heuristic which may or may not benefit a given
kernel-threaded application that makes intensive use of malloc. Only by trying different
configurations can you determine whether any speed improvement can be obtained from
per-thread cache for a given application, and what the optimal tuning is for that
application.
Impact
Although there will be no impact on performance if cache is not configured (or if
application is not kernel-threaded), significant speed performance improvements are
possible for some kernel applications if cache is configured.
A small additional space cost (in process heap size) is associated with the cache
machinery. While there is no per-block space cost for caching small blocks, there is a
small space cost per ordinary block cached. Therefore, ISVs whose applications are very
memory intensive may want to configure only a minimum-sized or very small ordinary
cache when experimenting with this feature.
The malloc() thread-private cache does not change the function of malloc() for
nonthreaded or CMA-threaded applications. It does maintain binary compatibility.
However, because it is a change in allocation policy, it can cause different sequences of
addresses to be emitted for the same sequence of requests than a previous version of
malloc would have emitted. This level of compatibility is more stringent than ordinary
binary compatibility and has never been guaranteed across releases of malloc.
The libcres.a Library
Provided with the original release of 11i, libcres.a is a small archive library that
contains string, memory and other functions, to provide customers running
performance-critical applications with the benefit of a static link.
Linking statically with libc is not a supported method of linking an application. Any
performance improvement is highly dependent on the applications use of the included
functions. The functions included in this library are as follows:
abs(), bsearch(), div(), ffs(), insque(), labs(), ldiv(), memchr(),
memcmp(), memcpy(), memmove(), memset(), strcat(), strchr(), strcmp(),
strcpy(), strcspn(), strlen(), strncat(), strncmp(), strcpy(), strrchr(),
strspn(), strstr(), swab()
To make use of this library, existing makefiles must be modified to include it on the link
line. Existing applications must be re-linked to use this library.
The modules of this library are compiled with the HP optimizing compiler using a
+O4flag. As a result, the applications using this library can be linked only by using the
HP optimizing compiler.
The functions in this library cannot be overwritten with a user-defined function of the
same name, as is the case today with libc names. If this library is used, user libraries
cannot contain identically named functions or unexpected results may occur.
Impact
Performance of some applications may improve by using this library. The improvement is
highly dependent on the applications use of the included functions.