diff options
| author | otto <> | 2008-07-28 19:53:03 +0000 |
|---|---|---|
| committer | otto <> | 2008-07-28 19:53:03 +0000 |
| commit | 37873c9cd14ab301b21d6bc491510bceeeef57f4 (patch) | |
| tree | 864c4563053cdb33a8301d78c70925d23740250b /src/lib/libc/stdlib | |
| parent | b27d6e846482338e09c058638005f2b0c06b1832 (diff) | |
| download | openbsd-37873c9cd14ab301b21d6bc491510bceeeef57f4.tar.gz openbsd-37873c9cd14ab301b21d6bc491510bceeeef57f4.tar.bz2 openbsd-37873c9cd14ab301b21d6bc491510bceeeef57f4.zip | |
man page bits for new malloc; ok jmc@
Diffstat (limited to 'src/lib/libc/stdlib')
| -rw-r--r-- | src/lib/libc/stdlib/malloc.3 | 76 |
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 . |
| 246 | Fill some junk into the area allocated. | 246 | Fill some junk into the area allocated. |
| 247 | Currently junk is bytes of 0xd0; this is pronounced | 247 | Currently junk is bytes of 0xd0 when allocating; this is pronounced |
| 248 | .Dq Duh . | 248 | .Dq Duh . |
| 249 | \&:-) | 249 | \&:-) |
| 250 | Freed chunks are filled with 0xdf. | ||
| 250 | .It Cm N | 251 | .It Cm N |
| 251 | Do not output warning messages when encountering possible corruption | 252 | Do not output warning messages when encountering possible corruption |
| 252 | or bad pointers. | 253 | or bad pointers. |
| 253 | .It Cm P | 254 | .It Cm P |
| 254 | .Dq Pointer Protection . | 255 | .Dq Move allocations within a page. |
| 255 | Pointer sized allocations are aligned to the end of a page to catch | 256 | Allocations larger than half a page but smaller that a page |
| 256 | sizeof(ptr) errors where sizeof(*ptr) is meant. | 257 | are aligned to the end of a page to catch buffer overruns in more |
| 258 | cases. | ||
| 257 | .It Cm R | 259 | .It Cm R |
| 258 | .Dq realloc . | 260 | .Dq realloc . |
| 259 | Always reallocate when | 261 | Always reallocate when |
| @@ -278,6 +280,9 @@ including in the source: | |||
| 278 | extern char *malloc_options; | 280 | extern char *malloc_options; |
| 279 | malloc_options = "X"; | 281 | malloc_options = "X"; |
| 280 | .Ed | 282 | .Ed |
| 283 | .Pp | ||
| 284 | Note that this will cause code that is supposed to handle | ||
| 285 | out-of-memory conditions gracefully to abort instead. | ||
| 281 | .It Cm Z | 286 | .It Cm Z |
| 282 | .Dq Zero . | 287 | .Dq Zero . |
| 283 | Fill some junk into the area allocated (see | 288 | Fill some junk into the area allocated (see |
| @@ -302,7 +307,7 @@ flags are mostly for testing and debugging. | |||
| 302 | If a program changes behavior if either of these options are used, | 307 | If a program changes behavior if either of these options are used, |
| 303 | it is buggy. | 308 | it is buggy. |
| 304 | .Pp | 309 | .Pp |
| 305 | The default number of free pages cached is 16. | 310 | The default number of free pages cached is 64. |
| 306 | .Sh RETURN VALUES | 311 | .Sh RETURN VALUES |
| 307 | The | 312 | The |
| 308 | .Fn malloc | 313 | .Fn malloc |
| @@ -357,13 +362,7 @@ the process. | |||
| 357 | .Pp | 362 | .Pp |
| 358 | Here is a brief description of the error messages and what they mean: | 363 | Here 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 | ||
| 362 | has been compiled with | ||
| 363 | .Dv \&-DEXTRA_SANITY | ||
| 364 | and something looks fishy in there. | ||
| 365 | Consult sources and/or wizards. | ||
| 366 | .It Dq allocation failed | ||
| 367 | If the | 366 | If the |
| 368 | .Cm A | 367 | .Cm A |
| 369 | option is specified it is an error for | 368 | option is specified it is an error for |
| @@ -373,47 +372,32 @@ or | |||
| 373 | .Fn realloc | 372 | .Fn realloc |
| 374 | to return | 373 | to return |
| 375 | .Dv NULL . | 374 | .Dv NULL . |
| 376 | .It Dq mmap(2) failed, check limits. | 375 | .It Dq malloc init mmap failed |
| 377 | This is a rather weird condition that is most likely to indicate a | 376 | This is a rather weird condition that is most likely to indicate a |
| 378 | seriously overloaded system or a ulimit restriction. | 377 | seriously 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 |
| 381 | internal freelist has been stomped on. | 380 | detected an internal error; |
| 381 | consult sources and/or wizards. | ||
| 382 | .El | 382 | .El |
| 383 | .Pp | 383 | .Pp |
| 384 | Here is a brief description of the warning messages and what they mean: | 384 | Here 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?) |
| 387 | An attempt to | ||
| 388 | .Fn free | ||
| 389 | or | ||
| 390 | .Fn realloc | ||
| 391 | an unallocated pointer was made. | ||
| 392 | .It Dq chunk is already free | ||
| 387 | There was an attempt to free a chunk that had already been freed. | 393 | There 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 |
| 389 | The pointer doesn't make sense. | ||
| 390 | It's above the area of memory that | ||
| 391 | .Fn malloc | ||
| 392 | knows something about. | ||
| 393 | This could be a pointer from some | ||
| 394 | .Xr mmap 2 'ed | ||
| 395 | memory. | ||
| 396 | .It Dq junk pointer, too low to make sense. | ||
| 397 | The pointer doesn't make sense. | ||
| 398 | It's below the area of memory that | ||
| 399 | .Fn malloc | ||
| 400 | knows something about. | ||
| 401 | This pointer probably came from your data or bss segments. | ||
| 402 | .It Dq malloc() has never been called. | ||
| 403 | Nothing has ever been allocated, yet something is being freed or | ||
| 404 | realloc'ed. | ||
| 405 | .It Dq modified (chunk-/page-) pointer. | ||
| 406 | The pointer passed to | 395 | The pointer passed to |
| 407 | .Fn free | 396 | .Fn free |
| 408 | or | 397 | or |
| 409 | .Fn realloc | 398 | .Fn realloc |
| 410 | has been modified. | 399 | has been modified. |
| 411 | .It Dq pointer to wrong page. | 400 | .It Dq recursive call |
| 412 | The pointer that | ||
| 413 | .Fn malloc | ||
| 414 | is trying to free is not pointing to | ||
| 415 | a sensible page. | ||
| 416 | .It Dq recursive call. | ||
| 417 | An attempt was made to call recursively into these functions, i.e., from a | 401 | An attempt was made to call recursively into these functions, i.e., from a |
| 418 | signal handler. | 402 | signal handler. |
| 419 | This behavior is not supported. | 403 | This behavior is not supported. |
| @@ -428,6 +412,12 @@ functions nor utilize any other functions which may call | |||
| 428 | routines). | 412 | routines). |
| 429 | .It Dq unknown char in MALLOC_OPTIONS | 413 | .It Dq unknown char in MALLOC_OPTIONS |
| 430 | We found something we didn't understand. | 414 | We found something we didn't understand. |
| 415 | .It Dq malloc cache overflow/underflow | ||
| 416 | The internal malloc page cache has been corrupted. | ||
| 417 | .It Dq malloc free slot lost | ||
| 418 | The internal malloc page cache has been corrupted. | ||
| 419 | .It Dq guard size | ||
| 420 | An 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 , |
