diff options
author | peter <peter@FreeBSD.org> | 1999-11-12 16:41:21 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1999-11-12 16:41:21 +0000 |
commit | 70fc0d318e7b73855ad6367ae9820262a1947403 (patch) | |
tree | f2713aba3343533baa67265810fe3cd6464e5508 /lib/libc | |
parent | 1b5e9c01a918d993ce544ac3100ae7bdb5561f54 (diff) | |
download | FreeBSD-src-70fc0d318e7b73855ad6367ae9820262a1947403.zip FreeBSD-src-70fc0d318e7b73855ad6367ae9820262a1947403.tar.gz |
Go to a bit more trouble to make it absolutely clear that malloc(3)
does not zero the allocated memory.
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/stdlib/malloc.3 | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/libc/stdlib/malloc.3 b/lib/libc/stdlib/malloc.3 index de93382..764bad1 100644 --- a/lib/libc/stdlib/malloc.3 +++ b/lib/libc/stdlib/malloc.3 @@ -73,6 +73,12 @@ If .Fn malloc fails, a NULL pointer is returned. .Pp +Note that +.Fn malloc +does +.Em NOT +normally initialize the returned memory to zero bytes. +.Pp The .Fn calloc function allocates space for @@ -85,7 +91,8 @@ The result is identical to calling .Fn malloc with an argument of .Dq "number * size" , -with the exception that the allocated memory is initialized to nul bytes. +with the exception that the allocated memory is explicitly initialized +to zero bytes. .Pp The .Fn realloc @@ -310,7 +317,7 @@ options and symbols for debugger support. If the program starts to give unusual results, coredump or generally behave differently without emitting any of the messages listed in the next section, it is likely because it depends on the storage being filled with -nul bytes. Try running it with +zero bytes. Try running it with .Dq Z option set; if that improves the situation, this diagnosis has been confirmed. |