libmtmalloc(3LIB) Interface Libraries libmtmalloc(3LIB)NAMElibmtmalloc - multi-threaded memory allocator library
SYNOPSIS
cc [ flag... ] file... -lmtmalloc [ library... ]
#include <mtmalloc.h>
DESCRIPTION
Functions in this library provide concurrent access to heap space.
INTERFACES
The shared object libmtmalloc.so.1 provides the public interfaces
defined below. See intro(3) for additional information on shared object
interfaces.
free malloc
mallocctl memalign
realloc valloc
ENVIRONMENT VARIABLES
MTMALLOC_OPTIONS
A comma separated list of options. The supported options are:
MTEXCLUSIVE=Y
By default, libmtmalloc allocates 2*NCPUS buckets from which
allocations occur. Threads share buckets based on their thread
ID. If MTEXCLUSIVE is invoked, then 4*NCPUS buckets are used.
Threads with thread id less than 2*NCPUS receive an exclusive
bucket and thus do not need to use locks. Allocation perfor‐
mance for these buckets may be dramatically increased. One
enabled MTEXCLUSIVE can not be disabled. This feature can be
enabled by setting the MTMALLOC_OPTION MTEXCLUSIVE to "Y" or
"y" or anything beginning with "y". Alternatively it can be
enabled by a call to mallocctl(3MALLOC).
MTMAXCACHE=16, 17, 18, 19, 20, or 21
By default, allocations less than 2^16 bytes are allocated from
buckets indexed by thread id. Using this MTMALLOC_OPTION set‐
ting, variable size of the cached allocations can be increased
to 2^17, 2^18, 2^18, 2^19, 2^20, or 2^21 by setting MTMAXCACHE
to 17, 18, 19, 20, or 21. If MTMAXCACHE is set to less than 16
it is reset to 16. If MTMAXCACHE is set to more than 21, then
it is reset to 21. This all occurs silently.
MTCHUNKSIZE=xx
Allocation buckets are sized by the chunk size and the size of
the allocation request. The default setting is 9 for 32-bit
applications and 64 for 64 bit applications. For the cost of
address space, performance can sometimes be enhanced by
increasing this parameter. See mallocctl(3MALLOC).
MTREALFREE=xx
If xx > 1, set the threshold for calling madvise(3C) with
MADV_FREE. Calling madvise() will result in the memory associ‐
ated with the allocation being returned to the kernel. When
freed, allocations greater than xx*pagesize will have madvise()
called. If xx is less than 2, it will be set to 2.
MTDEBUGPATTERN=Y
Writes misaligned data into the buffer after free(). When the
buffer is reallocated, the contents are verified to ensure that
there was no access to the buffer after the free. If the buffer
has been dirtied, a SIGABRT signal is delivered to the process.
The default behavior is not to write misaligned data. The pat‐
tern used is 0xdeadbeef. Use of this option results in a per‐
formance penalty.
MTINITBUFFER=Y
Writes misaligned data into the newly allocated buffer. This
option is useful for detecting some accesses before initializa‐
tion. The default behavior is not to write misaligned data to
the newly allocated buffer. The pattern used is 0xbaddcafe. Use
of this option results in a performance penalty.
MTDOUBLEFREE=Y
Allows double free of a pointer. The default behavior of double
free results in a core dump.
FILES
/usr/lib/libmtmalloc.so.1
shared object
/usr/lib/64/libmtmalloc.so.1
64-bit shared object
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
┌─────────────────────────────┬─────────────────────────────┐
│ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
├─────────────────────────────┼─────────────────────────────┤
│Availability │system/library (32-bit) │
├─────────────────────────────┼─────────────────────────────┤
│ │SUNWcslx (64-bit) │
├─────────────────────────────┼─────────────────────────────┤
│MT-Level │Safe │
└─────────────────────────────┴─────────────────────────────┘
SEE ALSOpvs(1), sbrk(2), intro(3), malloc(3C), malloc(3MALLOC), mapmalloc(3MAL‐
LOC), mtmalloc(3MALLOC), attributes(5)SunOS 5.10 5 Nov 2010 libmtmalloc(3LIB)