summaryrefslogtreecommitdiff
path: root/usr/src/man/man3malloc
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/man/man3malloc')
-rw-r--r--usr/src/man/man3malloc/bsdmalloc.3malloc6
-rw-r--r--usr/src/man/man3malloc/malloc.3malloc25
-rw-r--r--usr/src/man/man3malloc/mapmalloc.3malloc13
-rw-r--r--usr/src/man/man3malloc/mtmalloc.3malloc25
-rw-r--r--usr/src/man/man3malloc/umem_alloc.3malloc37
-rw-r--r--usr/src/man/man3malloc/umem_cache_create.3malloc97
-rw-r--r--usr/src/man/man3malloc/umem_debug.3malloc35
-rw-r--r--usr/src/man/man3malloc/watchmalloc.3malloc19
8 files changed, 76 insertions, 181 deletions
diff --git a/usr/src/man/man3malloc/bsdmalloc.3malloc b/usr/src/man/man3malloc/bsdmalloc.3malloc
index 4b00266f4d..2afb35edd1 100644
--- a/usr/src/man/man3malloc/bsdmalloc.3malloc
+++ b/usr/src/man/man3malloc/bsdmalloc.3malloc
@@ -3,7 +3,7 @@
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH bsdmalloc 3MALLOC "21 Mar 2005" "SunOS 5.11" "Memory Allocation Library Functions"
+.TH BSDMALLOC 3MALLOC "Mar 21, 2005"
.SH NAME
bsdmalloc \- memory allocator
.SH SYNOPSIS
@@ -69,24 +69,20 @@ If \fBmalloc()\fR or \fBrealloc()\fR returns unsuccessfully, \fBerrno\fR will
be set to indicate the following:
.sp
.ne 2
-.mk
.na
\fB\fBENOMEM\fR\fR
.ad
.RS 10n
-.rt
\fIsize\fR bytes of memory cannot be allocated because it exceeds the physical
limits of the system.
.RE
.sp
.ne 2
-.mk
.na
\fB\fBEAGAIN\fR\fR
.ad
.RS 10n
-.rt
There is not enough memory available at this point in time to allocate
\fIsize\fR bytes of memory; but the application could try again later.
.RE
diff --git a/usr/src/man/man3malloc/malloc.3malloc b/usr/src/man/man3malloc/malloc.3malloc
index 91220b879c..f715ef9279 100644
--- a/usr/src/man/man3malloc/malloc.3malloc
+++ b/usr/src/man/man3malloc/malloc.3malloc
@@ -3,7 +3,7 @@
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH malloc 3MALLOC "11 May 2005" "SunOS 5.11" "Memory Allocation Library Functions"
+.TH MALLOC 3MALLOC "May 11, 2005"
.SH NAME
malloc, free, memalign, realloc, valloc, calloc, mallopt, mallinfo \- memory
allocator
@@ -109,12 +109,10 @@ The \fBmallopt()\fR function provides for control over the allocation
algorithm. The available values for \fIcmd\fR are:
.sp
.ne 2
-.mk
.na
\fB\fBM_MXFAST\fR\fR
.ad
.RS 12n
-.rt
Set \fImaxfast\fR to \fIvalue\fR. The algorithm allocates all blocks below the
size of \fImaxfast\fR in large groups and then doles them out very quickly. The
default value for \fImaxfast\fR is 24.
@@ -122,12 +120,10 @@ default value for \fImaxfast\fR is 24.
.sp
.ne 2
-.mk
.na
\fB\fBM_NLBLKS\fR\fR
.ad
.RS 12n
-.rt
Set \fInumlblks\fR to \fIvalue\fR. The above mentioned ``large groups'' each
contain \fInumlblks\fR blocks. \fInumlblks\fR must be greater than 0. The
default value for \fInumlblks\fR is 100.
@@ -135,12 +131,10 @@ default value for \fInumlblks\fR is 100.
.sp
.ne 2
-.mk
.na
\fB\fBM_GRAIN\fR\fR
.ad
.RS 12n
-.rt
Set \fIgrain\fR to \fIvalue\fR. The sizes of all blocks smaller than
\fImaxfast\fR are considered to be rounded up to the nearest multiple of
\fIgrain\fR. \fIgrain\fR must be greater than 0. The default value of
@@ -151,12 +145,10 @@ data type. Value will be rounded up to a multiple of the default when
.sp
.ne 2
-.mk
.na
\fB\fBM_KEEP\fR\fR
.ad
.RS 12n
-.rt
Preserve data in a freed block until the next \fBmalloc()\fR, \fBrealloc()\fR,
or \fBcalloc()\fR. This option is provided only for compatibility with the old
version of \fBmalloc()\fR, and it is not recommended.
@@ -214,24 +206,20 @@ If \fBmalloc()\fR, \fBcalloc()\fR, or \fBrealloc()\fR returns unsuccessfully,
\fBerrno\fR is set to indicate the error:
.sp
.ne 2
-.mk
.na
\fB\fBENOMEM\fR\fR
.ad
.RS 10n
-.rt
\fIsize\fR bytes of memory exceeds the physical limits of your system, and
cannot be allocated.
.RE
.sp
.ne 2
-.mk
.na
\fB\fBEAGAIN\fR\fR
.ad
.RS 10n
-.rt
There is not enough memory available at this point in time to allocate
\fIsize\fR bytes of memory; but the application could try again later.
.RE
@@ -262,13 +250,12 @@ See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
.TS
-tab() box;
-cw(2.75i) |cw(2.75i)
-lw(2.75i) |lw(2.75i)
-.
-ATTRIBUTE TYPEATTRIBUTE VALUE
+box;
+c | c
+l | l .
+ATTRIBUTE TYPE ATTRIBUTE VALUE
_
-MT-LevelSafe
+MT-Level Safe
.TE
.SH SEE ALSO
diff --git a/usr/src/man/man3malloc/mapmalloc.3malloc b/usr/src/man/man3malloc/mapmalloc.3malloc
index ec857e48d4..969296d473 100644
--- a/usr/src/man/man3malloc/mapmalloc.3malloc
+++ b/usr/src/man/man3malloc/mapmalloc.3malloc
@@ -3,7 +3,7 @@
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH mapmalloc 3MALLOC "20 Feb 2004" "SunOS 5.11" "Memory Allocation Library Functions"
+.TH MAPMALLOC 3MALLOC "Feb 20, 2004"
.SH NAME
mapmalloc \- memory allocator
.SH SYNOPSIS
@@ -100,13 +100,12 @@ See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
.TS
-tab() box;
-cw(2.75i) |cw(2.75i)
-lw(2.75i) |lw(2.75i)
-.
-ATTRIBUTE TYPEATTRIBUTE VALUE
+box;
+c | c
+l | l .
+ATTRIBUTE TYPE ATTRIBUTE VALUE
_
-MT-LevelSafe
+MT-Level Safe
.TE
.SH SEE ALSO
diff --git a/usr/src/man/man3malloc/mtmalloc.3malloc b/usr/src/man/man3malloc/mtmalloc.3malloc
index 4a4ab93b51..1ca7a31fd8 100644
--- a/usr/src/man/man3malloc/mtmalloc.3malloc
+++ b/usr/src/man/man3malloc/mtmalloc.3malloc
@@ -3,7 +3,7 @@
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH mtmalloc 3MALLOC "21 Mar 2005" "SunOS 5.11" "Memory Allocation Library Functions"
+.TH MTMALLOC 3MALLOC "Mar 21, 2005"
.SH NAME
mtmalloc, mallocctl \- MT hot memory allocator
.SH SYNOPSIS
@@ -104,12 +104,10 @@ library. The options fall into two general classes, debugging options and
performance options.
.sp
.ne 2
-.mk
.na
\fB\fBMTDOUBLEFREE\fR\fR
.ad
.RS 18n
-.rt
Allows double \fBfree\fR of a pointer. Setting \fIvalue\fR to \fB1\fR means
yes and \fB0\fR means no. The default behavior of double \fBfree\fR results in
a core dump.
@@ -117,12 +115,10 @@ a core dump.
.sp
.ne 2
-.mk
.na
\fB\fBMTDEBUGPATTERN\fR\fR
.ad
.RS 18n
-.rt
Writes misaligned data into the buffer after \fBfree()\fR. When the buffer is
reallocated, the contents are verified to ensure that there was no access to
the buffer after the \fBfree\fR. If the buffer has been dirtied, a
@@ -134,12 +130,10 @@ option results in a performance penalty.
.sp
.ne 2
-.mk
.na
\fB\fBMTINITBUFFER\fR\fR
.ad
.RS 18n
-.rt
Writes misaligned data into the newly allocated buffer. This option is useful
for detecting some accesses before initialization. Setting \fIvalue\fR to
\fB1\fR means yes and \fB0\fR means no. The default behavior is to \fInot\fR
@@ -149,12 +143,10 @@ write misaligned data to the newly allocated buffer. The pattern used is
.sp
.ne 2
-.mk
.na
\fB\fBMTCHUNKSIZE\fR\fR
.ad
.RS 18n
-.rt
This option changes the size of allocated memory when a pool has exhausted all
available memory in the buffer. Increasing this value allocates more memory
for the application. A substantial performance gain can occur because the
@@ -182,24 +174,20 @@ be set to indicate the error.
The \fBmalloc()\fR and \fBrealloc()\fR functions will fail if:
.sp
.ne 2
-.mk
.na
\fB\fBENOMEM\fR\fR
.ad
.RS 10n
-.rt
The physical limits of the system are exceeded by \fIsize\fR bytes of memory
which cannot be allocated.
.RE
.sp
.ne 2
-.mk
.na
\fB\fBEAGAIN\fR\fR
.ad
.RS 10n
-.rt
There is not enough memory available to allocate \fIsize\fR bytes of memory;
but the application could try again later.
.RE
@@ -217,13 +205,12 @@ See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
.TS
-tab() box;
-cw(2.75i) |cw(2.75i)
-lw(2.75i) |lw(2.75i)
-.
-ATTRIBUTE TYPEATTRIBUTE VALUE
+box;
+c | c
+l | l .
+ATTRIBUTE TYPE ATTRIBUTE VALUE
_
-MT-LevelSafe
+MT-Level Safe
.TE
.SH SEE ALSO
diff --git a/usr/src/man/man3malloc/umem_alloc.3malloc b/usr/src/man/man3malloc/umem_alloc.3malloc
index 0f70a40182..65bf79e5f3 100644
--- a/usr/src/man/man3malloc/umem_alloc.3malloc
+++ b/usr/src/man/man3malloc/umem_alloc.3malloc
@@ -3,14 +3,14 @@
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH umem_alloc 3MALLOC "24 Mar 2008" "SunOS 5.11" "Memory Allocation Library Functions"
+.TH UMEM_ALLOC 3MALLOC "Mar 24, 2008"
.SH NAME
umem_alloc, umem_zalloc, umem_free, umem_nofail_callback \- fast, scalable
memory allocation
.SH SYNOPSIS
.LP
.nf
-cc [ \fIflag \&.\|.\|.\fR ] \fIfile\fR\&.\|.\|. \fB-lumem\fR [ \fIlibrary \&.\|.\|.\fR ]
+cc [ \fIflag \&.\|.\|.\fR ] \fIfile\fR\&.\|.\|. \fB-lumem\fR [ \fIlibrary \&.\|.\|.\fR ]
#include <umem.h>
\fBvoid *\fR\fBumem_alloc\fR(\fBsize_t\fR \fIsize\fR, \fBint\fR \fIflags\fR);
@@ -71,23 +71,19 @@ determines the behavior of \fBumem_alloc()\fR if it is unable to fulfill the
request. The \fIflags\fR argument can take the following values:
.sp
.ne 2
-.mk
.na
\fB\fBUMEM_DEFAULT\fR\fR
.ad
.RS 16n
-.rt
Return \fINULL\fR on failure.
.RE
.sp
.ne 2
-.mk
.na
\fB\fBUMEM_NOFAIL\fR\fR
.ad
.RS 16n
-.rt
Call an optional \fIcallback\fR (set with \fBumem_nofail_callback()\fR) on
failure. The \fIcallback\fR takes no arguments and can finish by:
.RS +4
@@ -156,17 +152,14 @@ See \fBumem_debug\fR(3MALLOC) for environment variables that effect the
debugging features of the \fBlibumem\fR library.
.sp
.ne 2
-.mk
.na
\fB\fBUMEM_OPTIONS\fR\fR
.ad
.RS 16n
-.rt
Contains a list of comma-separated options. Unrecognized options are ignored.
The options that are supported are:
.sp
.ne 2
-.mk
.na
\fB\fBbackend\fR=\fBsbrk\fR\fR
.ad
@@ -175,7 +168,6 @@ The options that are supported are:
\fB\fBbackend\fR=\fBmmap\fR\fR
.ad
.RS 16n
-.rt
Set the underlying function used to allocate memory. This option can be set to
\fBsbrk\fR (the default) for an \fBsbrk\fR(2)-based source or \fBmmap\fR for an
\fBmmap\fR(2)-based source. If set to a value that is not supported, \fBsbrk\fR
@@ -270,13 +262,13 @@ for (i = 0; i < 100; i++)
#include <thread.h>
#include <stdio.h>
#include <umem.h>
-
+
void *
start_func(void *the_arg)
{
int *info = (int *)the_arg;
char *buf = umem_alloc(1024 * 1024, UMEM_NOFAIL);
-
+
/* does not need to check for buf == NULL */
buf[0] = 0;
...
@@ -300,16 +292,16 @@ my_failure_handler(void)
umem_nofail_callback(my_failure_handler);
\&...
int my_arg;
-
+
thread_t tid;
void *status;
-
+
(void) thr_create(NULL, NULL, start_func, &my_arg, 0,
NULL);
\&...
while (thr_join(0, &tid, &status) != 0)
;
-
+
if (status == NULL) {
(void) fprintf(stderr, "thread %d ran out of memory\en",
tid);
@@ -326,17 +318,16 @@ See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
.TS
-tab() box;
-cw(2.75i) |cw(2.75i)
-lw(2.75i) |lw(2.75i)
-.
-ATTRIBUTE TYPEATTRIBUTE VALUE
+box;
+c | c
+l | l .
+ATTRIBUTE TYPE ATTRIBUTE VALUE
_
-Interface StabilityCommitted
+Interface Stability Committed
_
-MT-LevelMT-Safe
+MT-Level MT-Safe
_
-StandardSee below.
+Standard See below.
.TE
.sp
diff --git a/usr/src/man/man3malloc/umem_cache_create.3malloc b/usr/src/man/man3malloc/umem_cache_create.3malloc
index b76bbc7837..03668b4096 100644
--- a/usr/src/man/man3malloc/umem_cache_create.3malloc
+++ b/usr/src/man/man3malloc/umem_cache_create.3malloc
@@ -3,14 +3,14 @@
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH umem_cache_create 3MALLOC "24 Mar 2008" "SunOS 5.11" "Memory Allocation Library Functions"
+.TH UMEM_CACHE_CREATE 3MALLOC "Mar 24, 2008"
.SH NAME
umem_cache_create, umem_cache_destroy, umem_cache_alloc, umem_cache_free \-
allocation cache manipulation
.SH SYNOPSIS
.LP
.nf
-cc [ \fIflag \&.\|.\|.\fR ] \fIfile\fR\&.\|.\|. \fB-lumem\fR [ \fIlibrary \&.\|.\|.\fR ]
+cc [ \fIflag \&.\|.\|.\fR ] \fIfile\fR\&.\|.\|. \fB-lumem\fR [ \fIlibrary \&.\|.\|.\fR ]
#include <umem.h>
\fBumem_cache_t *\fR\fBumem_cache_create\fR(\fBchar *\fR\fIdebug_name\fR, \fBsize_t\fR \fIbufsize\fR,
@@ -59,34 +59,28 @@ The \fBumem_cache_create()\fR function creates a cache of objects and takes as
arguments the following:
.sp
.ne 2
-.mk
.na
\fB\fIdebug_name\fR\fR
.ad
.RS 17n
-.rt
A human-readable name for debugging purposes.
.RE
.sp
.ne 2
-.mk
.na
\fB\fIbufsize\fR\fR
.ad
.RS 17n
-.rt
The size, in bytes, of the buffers in this cache.
.RE
.sp
.ne 2
-.mk
.na
\fB\fIalign\fR\fR
.ad
.RS 17n
-.rt
The minimum alignment required for buffers in this cache. This parameter must
be a power of 2. If 0, it is replaced with the minimum required alignment for
the current architecture.
@@ -94,67 +88,55 @@ the current architecture.
.sp
.ne 2
-.mk
.na
\fB\fIconstructor\fR\fR
.ad
.RS 17n
-.rt
The callback to construct an object.
.RE
.sp
.ne 2
-.mk
.na
\fB\fIdestructor\fR\fR
.ad
.RS 17n
-.rt
The callback to destroy an object.
.RE
.sp
.ne 2
-.mk
.na
\fB\fIreclaim\fR\fR
.ad
.RS 17n
-.rt
The callback to reclaim objects.
.RE
.sp
.ne 2
-.mk
.na
\fB\fIcallback_data\fR\fR
.ad
.RS 17n
-.rt
An opaque pointer passed to the callbacks.
.RE
.sp
.ne 2
-.mk
.na
\fB\fIsource\fR\fR
.ad
.RS 17n
-.rt
This parameter must be \fINULL\fR.
.RE
.sp
.ne 2
-.mk
.na
\fB\fIcflags\fR\fR
.ad
.RS 17n
-.rt
This parameter must be either 0 or \fBUMC_NODEBUG\fR. If \fBUMC_NODEBUG\fR, all
debugging features are disabled for this cache. See \fBumem_debug\fR(3MALLOC).
.RE
@@ -208,23 +190,19 @@ has any outstanding allocations, the behavior is undefined.
The \fBumem_cache_alloc()\fR function takes as arguments:
.sp
.ne 2
-.mk
.na
\fB\fIcache\fR\fR
.ad
.RS 9n
-.rt
a cache pointer
.RE
.sp
.ne 2
-.mk
.na
\fB\fIflags\fR\fR
.ad
.RS 9n
-.rt
flags that determine the behavior if \fBumem_cache_alloc()\fR is unable to
fulfill the allocation request
.RE
@@ -261,24 +239,20 @@ behavior:
.sp
.ne 2
-.mk
.na
\fB\fBUMEM_DEFAULT\fR\fR
.ad
.RS 16n
-.rt
The \fBumem_cache_alloc()\fR function returns \fINULL\fR if the allocation
fails.
.RE
.sp
.ne 2
-.mk
.na
\fB\fBUMEM_NOFAIL\fR\fR
.ad
.RS 16n
-.rt
The \fBumem_cache_alloc()\fR function cannot return \fINULL\fR. A callback is
used to determine what action occurs. See \fBumem_alloc\fR(3MALLOC) for more
information.
@@ -293,23 +267,19 @@ information.
The \fBumem_cache_free()\fR function takes as arguments:
.sp
.ne 2
-.mk
.na
\fB\fIcache\fR\fR
.ad
.RS 9n
-.rt
a cache pointer
.RE
.sp
.ne 2
-.mk
.na
\fB\fIbuf\fR\fR
.ad
.RS 9n
-.rt
a pointer previously returned from \fBumem_cache_alloc()\fR. This argument must
not be \fINULL\fR.
.RE
@@ -341,23 +311,19 @@ Upon failure, the \fBumem_cache_create()\fR function returns a null pointer.
The \fBumem_cache_create()\fR function will fail if:
.sp
.ne 2
-.mk
.na
\fB\fBEAGAIN\fR\fR
.ad
.RS 10n
-.rt
There is not enough memory available to allocate the cache data structure.
.RE
.sp
.ne 2
-.mk
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
-.rt
The \fIdebug_name\fR argument is \fINULL\fR, the \fIalign\fR argument is not a
power of two or is larger than the system pagesize, or the \fIbufsize\fR
argument is 0.
@@ -365,12 +331,10 @@ argument is 0.
.sp
.ne 2
-.mk
.na
\fB\fBENOMEM\fR\fR
.ad
.RS 10n
-.rt
The \fBlibumem\fR library could not be initialized, or the \fIbufsize\fR
argument is too large and its use would cause integer overflow to occur.
.RE
@@ -415,12 +379,12 @@ umem_cache_free(my_obj_cache, cur);
#define _REENTRANT
#include <synch.h>
#include <umem.h>
-
+
typedef struct my_obj {
mutex_t my_mutex;
long my_data;
} my_obj_t;
-
+
/*
* my_objs can only be freed when my_mutex is unlocked.
*/
@@ -428,22 +392,22 @@ int
my_obj_constructor(void *buf, void *ignored, int flags)
{
my_obj_t *myobj = buf;
-
+
(void) mutex_init(&my_obj->my_mutex, USYNC_THREAD, NULL);
-
+
return (0);
}
-
+
void
my_obj_destructor(void *buf, void *ignored)
{
my_obj_t *myobj = buf;
-
+
(void) mutex_destroy(&my_obj->my_mutex);
}
-
+
umem_cache_t *my_obj_cache;
-
+
\&...
my_obj_cache = umem_cache_create("my_obj", sizeof (my_obj_t),
0, my_obj_constructor, my_obj_destructor, NULL, NULL,
@@ -532,54 +496,54 @@ typedef struct my_obj {
char *my_buffer;
size_t my_size;
} my_obj_t;
-
+
/*
* my_size and the my_buffer pointer should never be changed
*/
-
+
int
my_obj_constructor(void *buf, void *arg, int flags)
{
size_t sz = (size_t)arg;
-
+
my_obj_t *myobj = buf;
-
+
if ((myobj->my_buffer = umem_alloc(sz, flags)) == NULL)
return (1);
-
+
my_size = sz;
-
+
return (0);
}
-
+
void
my_obj_destructor(void *buf, void *arg)
{
size_t sz = (size_t)arg;
-
+
my_obj_t *myobj = buf;
-
+
assert(sz == buf->my_size);
umem_free(myobj->my_buffer, sz);
}
-
+
\&...
umem_cache_t *my_obj_4k_cache;
umem_cache_t *my_obj_8k_cache;
\&...
my_obj_cache_4k = umem_cache_create("my_obj_4k", sizeof (my_obj_t),
- 0, my_obj_constructor, my_obj_destructor, NULL,
+ 0, my_obj_constructor, my_obj_destructor, NULL,
(void *)4096, NULL, 0);
-
+
my_obj_cache_8k = umem_cache_create("my_obj_8k", sizeof (my_obj_t),
- 0, my_obj_constructor, my_obj_destructor, NULL,
+ 0, my_obj_constructor, my_obj_destructor, NULL,
(void *)8192, NULL, 0);
\&...
my_obj_t *my_obj_4k = umem_cache_alloc(my_obj_4k_cache,
UMEM_DEFAULT);
my_obj_t *my_obj_8k = umem_cache_alloc(my_obj_8k_cache,
UMEM_DEFAULT);
-/* no assumptions should be made about the contents
+/* no assumptions should be made about the contents
of the buffers */
\&...
/* make sure to return them to the correct cache */
@@ -601,15 +565,14 @@ See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
.TS
-tab() box;
-cw(2.75i) |cw(2.75i)
-lw(2.75i) |lw(2.75i)
-.
-ATTRIBUTE TYPEATTRIBUTE VALUE
+box;
+c | c
+l | l .
+ATTRIBUTE TYPE ATTRIBUTE VALUE
_
-Interface StabilityCommitted
+Interface Stability Committed
_
-MT-LevelMT-Safe
+MT-Level MT-Safe
.TE
.SH SEE ALSO
diff --git a/usr/src/man/man3malloc/umem_debug.3malloc b/usr/src/man/man3malloc/umem_debug.3malloc
index 52272331a1..9d308f2156 100644
--- a/usr/src/man/man3malloc/umem_debug.3malloc
+++ b/usr/src/man/man3malloc/umem_debug.3malloc
@@ -3,7 +3,7 @@
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH umem_debug 3MALLOC "26 July 2002" "SunOS 5.11" "Memory Allocation Library Functions"
+.TH UMEM_DEBUG 3MALLOC "Jul 26, 2002"
.SH NAME
umem_debug \- debugging features of the umem library
.SH SYNOPSIS
@@ -28,22 +28,18 @@ internal buffer that is readable with the \fB::umem_status\fR \fBmdb\fR(1)
.SH ENVIRONMENT VARIABLES
.sp
.ne 2
-.mk
.na
\fB\fBUMEM_DEBUG\fR\fR
.ad
.RS 16n
-.rt
This variable contains a list of comma-separated options. Unrecognized options
are ignored. Possible options include:
.sp
.ne 2
-.mk
.na
\fB\fBaudit\fR[=\fIframes\fR]\fR
.ad
.RS 20n
-.rt
This option enables the recording of auditing information, including thread ID,
high-resolution time stamp, and stack trace for the last action (allocation or
free) on every allocation. If transaction logging (see \fBUMEM_LOGGING\fR) is
@@ -61,12 +57,10 @@ This option also enables the \fBguards\fR option.
.sp
.ne 2
-.mk
.na
\fB\fBcontents\fR[=\fIcount\fR]\fR
.ad
.RS 20n
-.rt
If auditing and contents logging (see \fBUMEM_LOGGING\fR) are enabled, the
first \fIcount\fR bytes of each buffer are logged when they are freed. If a
buffer is shorter than \fIcount\fR bytes, it is logged in its entirety.
@@ -77,23 +71,19 @@ is used.
.sp
.ne 2
-.mk
.na
\fB\fBdefault\fR\fR
.ad
.RS 20n
-.rt
This option is equivalent to \fBaudit\fR,\fBcontents\fR,\fBguards\fR.
.RE
.sp
.ne 2
-.mk
.na
\fB\fBguards\fR\fR
.ad
.RS 20n
-.rt
This option enables filling allocated and freed buffers with special patterns
to help detect the use of uninitialized data and previously freed buffers. It
also enables an 8-byte redzone after each buffer that contains
@@ -115,12 +105,10 @@ for details.
.sp
.ne 2
-.mk
.na
\fB\fBverbose\fR\fR
.ad
.RS 20n
-.rt
The library writes error descriptions to standard error before aborting. These
messages are not localized.
.RE
@@ -129,34 +117,28 @@ messages are not localized.
.sp
.ne 2
-.mk
.na
\fB\fBUMEM_LOGGING\fR\fR
.ad
.RS 16n
-.rt
To be enabled, this variable should be set to a comma-separated list of
in-memory logs. The logs available are:
.sp
.ne 2
-.mk
.na
\fB\fBtransaction\fR[=\fIsize\fR]\fR
.ad
.RS 22n
-.rt
If the \fBaudit\fR debugging option is set (see \fBUMEM_DEBUG\fR), the audit
structures from previous transactions are entered into this log.
.RE
.sp
.ne 2
-.mk
.na
\fB\fBcontents\fR[=\fIsize\fR]\fR
.ad
.RS 22n
-.rt
If the \fBaudit\fR debugging option is set, the contents of objects are
recorded in this log as they are freed.
.sp
@@ -166,12 +148,10 @@ are saved.
.sp
.ne 2
-.mk
.na
\fB\fBfail\fR[=\fIsize\fR]\fR
.ad
.RS 22n
-.rt
Records are entered into this log for every failed allocation.
.RE
@@ -195,15 +175,14 @@ See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
.TS
-tab() box;
-cw(2.75i) |cw(2.75i)
-lw(2.75i) |lw(2.75i)
-.
-ATTRIBUTE TYPEATTRIBUTE VALUE
+box;
+c | c
+l | l .
+ATTRIBUTE TYPE ATTRIBUTE VALUE
_
-Interface StabilityUnstable
+Interface Stability Unstable
_
-MT-LevelMT-Safe
+MT-Level MT-Safe
.TE
.SH SEE ALSO
diff --git a/usr/src/man/man3malloc/watchmalloc.3malloc b/usr/src/man/man3malloc/watchmalloc.3malloc
index 364c359952..6f8407b019 100644
--- a/usr/src/man/man3malloc/watchmalloc.3malloc
+++ b/usr/src/man/man3malloc/watchmalloc.3malloc
@@ -3,7 +3,7 @@
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH watchmalloc 3MALLOC "10 Jan 2007" "SunOS 5.11" "Memory Allocation Library Functions"
+.TH WATCHMALLOC 3MALLOC "Jan 10, 2007"
.SH NAME
watchmalloc \- debugging memory allocator
.SH SYNOPSIS
@@ -153,23 +153,19 @@ Further options are enabled by specifying a comma-separated string of options:
MALLOC_DEBUG=WATCH,RW,STOP
.sp
.ne 2
-.mk
.na
\fB\fBWATCH\fR\fR
.ad
.RS 9n
-.rt
Enables \fBWA_WRITE\fR watched areas as described above.
.RE
.sp
.ne 2
-.mk
.na
\fB\fBRW\fR\fR
.ad
.RS 9n
-.rt
Enables both \fBWA_READ\fR and \fBWA_WRITE\fR watched areas. An attempt either
to read or write freed memory or the red zones will trigger a watchpoint trap.
This incurs even more overhead and can cause the application to run up to 1000
@@ -178,12 +174,10 @@ times slower.
.sp
.ne 2
-.mk
.na
\fB\fBSTOP\fR\fR
.ad
.RS 9n
-.rt
The process will stop showing a \fBFLTWATCH\fR machine fault if it triggers a
watchpoint trap, rather than dumping core with a \fBSIGTRAP\fR signal. This
allows a debugger to be attached to the live process at the point where it
@@ -216,13 +210,12 @@ See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
.TS
-tab() box;
-cw(2.75i) |cw(2.75i)
-lw(2.75i) |lw(2.75i)
-.
-ATTRIBUTE TYPEATTRIBUTE VALUE
+box;
+c | c
+l | l .
+ATTRIBUTE TYPE ATTRIBUTE VALUE
_
-MT-LevelMT-Safe
+MT-Level MT-Safe
.TE
.SH SEE ALSO