summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorotto <>2008-07-28 19:53:03 +0000
committerotto <>2008-07-28 19:53:03 +0000
commit37873c9cd14ab301b21d6bc491510bceeeef57f4 (patch)
tree864c4563053cdb33a8301d78c70925d23740250b
parentb27d6e846482338e09c058638005f2b0c06b1832 (diff)
downloadopenbsd-37873c9cd14ab301b21d6bc491510bceeeef57f4.tar.gz
openbsd-37873c9cd14ab301b21d6bc491510bceeeef57f4.tar.bz2
openbsd-37873c9cd14ab301b21d6bc491510bceeeef57f4.zip
man page bits for new malloc; ok jmc@
-rw-r--r--src/lib/libc/stdlib/malloc.376
1 files changed, 33 insertions, 43 deletions
diff --git a/src/lib/libc/stdlib/malloc.3 b/src/lib/libc/stdlib/malloc.3
index 08318c35b9..8eeea6e58c 100644
--- a/src/lib/libc/stdlib/malloc.3
+++ b/src/lib/libc/stdlib/malloc.3
@@ -30,9 +30,9 @@
30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31.\" SUCH DAMAGE. 31.\" SUCH DAMAGE.
32.\" 32.\"
33.\" $OpenBSD: malloc.3,v 1.52 2008/05/20 11:25:26 jmc Exp $ 33.\" $OpenBSD: malloc.3,v 1.53 2008/07/28 19:53:03 otto Exp $
34.\" 34.\"
35.Dd $Mdocdate: May 20 2008 $ 35.Dd $Mdocdate: July 28 2008 $
36.Dt MALLOC 3 36.Dt MALLOC 3
37.Os 37.Os
38.Sh NAME 38.Sh NAME
@@ -244,16 +244,18 @@ If the machine is paging a lot this may help a bit.
244.It Cm J 244.It Cm J
245.Dq Junk . 245.Dq Junk .
246Fill some junk into the area allocated. 246Fill some junk into the area allocated.
247Currently junk is bytes of 0xd0; this is pronounced 247Currently junk is bytes of 0xd0 when allocating; this is pronounced
248.Dq Duh . 248.Dq Duh .
249\&:-) 249\&:-)
250Freed chunks are filled with 0xdf.
250.It Cm N 251.It Cm N
251Do not output warning messages when encountering possible corruption 252Do not output warning messages when encountering possible corruption
252or bad pointers. 253or bad pointers.
253.It Cm P 254.It Cm P
254.Dq Pointer Protection . 255.Dq Move allocations within a page.
255Pointer sized allocations are aligned to the end of a page to catch 256Allocations larger than half a page but smaller that a page
256sizeof(ptr) errors where sizeof(*ptr) is meant. 257are aligned to the end of a page to catch buffer overruns in more
258cases.
257.It Cm R 259.It Cm R
258.Dq realloc . 260.Dq realloc .
259Always reallocate when 261Always reallocate when
@@ -278,6 +280,9 @@ including in the source:
278extern char *malloc_options; 280extern char *malloc_options;
279malloc_options = "X"; 281malloc_options = "X";
280.Ed 282.Ed
283.Pp
284Note that this will cause code that is supposed to handle
285out-of-memory conditions gracefully to abort instead.
281.It Cm Z 286.It Cm Z
282.Dq Zero . 287.Dq Zero .
283Fill some junk into the area allocated (see 288Fill some junk into the area allocated (see
@@ -302,7 +307,7 @@ flags are mostly for testing and debugging.
302If a program changes behavior if either of these options are used, 307If a program changes behavior if either of these options are used,
303it is buggy. 308it is buggy.
304.Pp 309.Pp
305The default number of free pages cached is 16. 310The default number of free pages cached is 64.
306.Sh RETURN VALUES 311.Sh RETURN VALUES
307The 312The
308.Fn malloc 313.Fn malloc
@@ -357,13 +362,7 @@ the process.
357.Pp 362.Pp
358Here is a brief description of the error messages and what they mean: 363Here is a brief description of the error messages and what they mean:
359.Bl -tag -width Ds 364.Bl -tag -width Ds
360.It Dq (ES): mumble mumble mumble 365.It Dq out of memory
361.Fn malloc
362has been compiled with
363.Dv \&-DEXTRA_SANITY
364and something looks fishy in there.
365Consult sources and/or wizards.
366.It Dq allocation failed
367If the 366If the
368.Cm A 367.Cm A
369option is specified it is an error for 368option is specified it is an error for
@@ -373,47 +372,32 @@ or
373.Fn realloc 372.Fn realloc
374to return 373to return
375.Dv NULL . 374.Dv NULL .
376.It Dq mmap(2) failed, check limits. 375.It Dq malloc init mmap failed
377This is a rather weird condition that is most likely to indicate a 376This is a rather weird condition that is most likely to indicate a
378seriously overloaded system or a ulimit restriction. 377seriously overloaded system or a ulimit restriction.
379.It Dq freelist is destroyed. 378.It any other error
380.Fn malloc Ns 's 379.Fn malloc
381internal freelist has been stomped on. 380detected an internal error;
381consult sources and/or wizards.
382.El 382.El
383.Pp 383.Pp
384Here is a brief description of the warning messages and what they mean: 384Here is a brief description of the warning messages and what they mean:
385.Bl -tag -width Ds 385.Bl -tag -width Ds
386.It Dq chunk/page is already free. 386.It Dq bogus pointer (double free?)
387An attempt to
388.Fn free
389or
390.Fn realloc
391an unallocated pointer was made.
392.It Dq chunk is already free
387There was an attempt to free a chunk that had already been freed. 393There was an attempt to free a chunk that had already been freed.
388.It Dq junk pointer, too high to make sense. 394.It Dq modified (chunk-) pointer
389The pointer doesn't make sense.
390It's above the area of memory that
391.Fn malloc
392knows something about.
393This could be a pointer from some
394.Xr mmap 2 'ed
395memory.
396.It Dq junk pointer, too low to make sense.
397The pointer doesn't make sense.
398It's below the area of memory that
399.Fn malloc
400knows something about.
401This pointer probably came from your data or bss segments.
402.It Dq malloc() has never been called.
403Nothing has ever been allocated, yet something is being freed or
404realloc'ed.
405.It Dq modified (chunk-/page-) pointer.
406The pointer passed to 395The pointer passed to
407.Fn free 396.Fn free
408or 397or
409.Fn realloc 398.Fn realloc
410has been modified. 399has been modified.
411.It Dq pointer to wrong page. 400.It Dq recursive call
412The pointer that
413.Fn malloc
414is trying to free is not pointing to
415a sensible page.
416.It Dq recursive call.
417An attempt was made to call recursively into these functions, i.e., from a 401An attempt was made to call recursively into these functions, i.e., from a
418signal handler. 402signal handler.
419This behavior is not supported. 403This behavior is not supported.
@@ -428,6 +412,12 @@ functions nor utilize any other functions which may call
428routines). 412routines).
429.It Dq unknown char in MALLOC_OPTIONS 413.It Dq unknown char in MALLOC_OPTIONS
430We found something we didn't understand. 414We found something we didn't understand.
415.It Dq malloc cache overflow/underflow
416The internal malloc page cache has been corrupted.
417.It Dq malloc free slot lost
418The internal malloc page cache has been corrupted.
419.It Dq guard size
420An inconsistent guard size was detected.
431.El 421.El
432.Sh SEE ALSO 422.Sh SEE ALSO
433.Xr brk 2 , 423.Xr brk 2 ,