HP-UX 11i June 2001 Release Notes

Programming
Libraries
Chapter 13264
The thread-private cache is only available for kernel-threaded
applications, i.e. those linked with the pthread library. The installed
shared pthread library version must be PHCO_19666 or later, or the
application must be statically linked with an archive pthread library
that is version PHCO_19666 or later, or else cache is not available.
By default cache is not active and must be activated by setting
_M_CACHE_OPTS to a legal value. If _M_CACHE_OPTS is set to any out of
range values, it is ignored and cache remains disabled.
There are two portions to the thread private cache: one for ordinary
blocks and one for small blocks. Small blocks are blocks that are
allocated by the small block allocator (SBA), which is configured with the
environment variable _M_SBA_OPTS or by calls to mallopt(3C). The small
block cache is automatically active whenever both the ordinary block
cache and the SBA are active. The ordinary block cache is active only
when it is configured by setting _M_CACHE_OPTS. There are no mallopt()
options to configure the thread-private cache.
The following shows _M_CACHE_OPTS’s subparameters and their
meaning:
_M_CACHE_OPTS=
<bucket_size>
:
<buckets>
:
<retirement_age>
<bucket_size>
is (roughly) the number of cached ordinary blocks per
bucket that willbe held in theordinary block cache. The allowable values
range from 0 through 8*4096 = 32768. If
<bucket_size>
is set to 0,
cache is disabled.
<buckets>
is the number of power of 2 buckets that will be maintained
per thread. The allowable values range from 8 though 32. This value
controls the size of the largest ordinary block that can be cached. For
example,if
<buckets>
is 8, the largest ordinary block that can be cached
will be 2^8 or 256 bytes. If
<buckets>
is 16, the largest ordinary block
that can be cached will be 2^20 or 65536 bytes, etc.
<bucket_size>
*
<buckets>
is (exactly) the maximum number of
ordinary blocks that will be cached per thread. There is no maximum
number of small blocks that will be cached per thread if the small block
cache is active.
<retirement_age>
controls what happens to unused caches. It may
happen that an application has more threads initially than it does later
on. In that case, there will be unused caches, because caches are not
automatically freed on thread exit -- by default they kept and assigned
to newly-created threads. But for some applications, this could result in