diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2017-04-17 18:07:16 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2017-04-17 18:07:16 +0000 |
commit | fab95c90e9143f20d4c5a2fd0433a82223cf24aa (patch) | |
tree | 54bc318da8831241881bc7e140c01a58bf96f22f /lib/libc/stdlib/malloc.3 | |
parent | 93d0944c13957fc591574a44d19187f47329e915 (diff) |
consictently use .Dv NULL and a few other tweaks; ok schwarze@
Diffstat (limited to 'lib/libc/stdlib/malloc.3')
-rw-r--r-- | lib/libc/stdlib/malloc.3 | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/lib/libc/stdlib/malloc.3 b/lib/libc/stdlib/malloc.3 index 602787532ec..a943d1baf5a 100644 --- a/lib/libc/stdlib/malloc.3 +++ b/lib/libc/stdlib/malloc.3 @@ -30,9 +30,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $OpenBSD: malloc.3,v 1.112 2017/04/13 18:32:55 otto Exp $ +.\" $OpenBSD: malloc.3,v 1.113 2017/04/17 18:07:15 otto Exp $ .\" -.Dd $Mdocdate: April 13 2017 $ +.Dd $Mdocdate: April 17 2017 $ .Dt MALLOC 3 .Os .Sh NAME @@ -76,8 +76,8 @@ function allocates uninitialized space for an object of the specified .Fa size . .Fn malloc -maintains multiple lists of free blocks according to size, allocating -space from the appropriate list. +maintains multiple lists of free objects according to size, allocating +from the appropriate list or requesting memory from the kernel. The allocated space is suitably aligned (after possible pointer coercion) for storage of any type of object. .Pp @@ -128,9 +128,9 @@ allocation or, when appropriate, to be returned to the kernel using .Xr munmap 2 . If .Fa ptr -is a -.Dv NULL -pointer, no action occurs. +is +.Dv NULL , +no action occurs. If .Fa ptr was previously freed by @@ -158,7 +158,7 @@ the function is similar to .Fn reallocarray except it ensures newly allocated memory is cleared similar to -.Xr calloc 3 . +.Fn calloc . Memory that becomes unallocated while shrinking or moving existing allocations is explicitly discarded (meaning, pages of memory are disposed via @@ -167,17 +167,15 @@ and smaller allocations are cleared with .Xr explicit_bzero 3 ) . If .Fa ptr -is a -.Dv NULL -pointer, +is +.Dv NULL , .Fa oldnmemb is ignored and the call is equivalent to .Fn calloc . If .Fa ptr -is not a -.Dv NULL -pointer, +is not +.Dv NULL , .Fa oldnmemb must be a value such that .Fa oldnmemb @@ -214,9 +212,9 @@ with length is discarded while deallocating the whole object originally allocated. .Sh RETURN VALUES Upon successful completion, the allocation functions -return a pointer to the allocated space; otherwise, a +return a pointer to the allocated space; otherwise, .Dv NULL -pointer is returned and +is returned and .Va errno is set to .Er ENOMEM . @@ -249,7 +247,9 @@ to .Pp If .Fa ptr -is not NULL and multiplying +is not +.Dv NULL +and multiplying .Fa oldnmemb and .Fa size @@ -444,9 +444,6 @@ If the option is specified it is an error for the allocation functions to return .Dv NULL . -.It Dq malloc init mmap failed -This is a rather weird condition that is most likely to indicate a -seriously overloaded system or a ulimit restriction. .It Dq bogus pointer (double free?) An attempt to .Fn free |