Changeset View
Changeset View
Standalone View
Standalone View
head/share/man/man9/malloc.9
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | |||||
.In sys/types.h | .In sys/types.h | ||||
.In sys/malloc.h | .In sys/malloc.h | ||||
.Ft void * | .Ft void * | ||||
.Fn malloc "size_t size" "struct malloc_type *type" "int flags" | .Fn malloc "size_t size" "struct malloc_type *type" "int flags" | ||||
.Ft void * | .Ft void * | ||||
.Fn mallocarray "size_t nmemb" "size_t size" "struct malloc_type *type" "int flags" | .Fn mallocarray "size_t nmemb" "size_t size" "struct malloc_type *type" "int flags" | ||||
.Ft void | .Ft void | ||||
.Fn free "void *addr" "struct malloc_type *type" | .Fn free "void *addr" "struct malloc_type *type" | ||||
.Ft void | |||||
.Fn zfree "void *addr" "struct malloc_type *type" | |||||
.Ft void * | .Ft void * | ||||
.Fn realloc "void *addr" "size_t size" "struct malloc_type *type" "int flags" | .Fn realloc "void *addr" "size_t size" "struct malloc_type *type" "int flags" | ||||
.Ft void * | .Ft void * | ||||
.Fn reallocf "void *addr" "size_t size" "struct malloc_type *type" "int flags" | .Fn reallocf "void *addr" "size_t size" "struct malloc_type *type" "int flags" | ||||
.Fn MALLOC_DECLARE type | .Fn MALLOC_DECLARE type | ||||
.In sys/param.h | .In sys/param.h | ||||
.In sys/malloc.h | .In sys/malloc.h | ||||
.In sys/kernel.h | .In sys/kernel.h | ||||
Show All 40 Lines | |||||
The memory is not zeroed. | The memory is not zeroed. | ||||
If | If | ||||
.Fa addr | .Fa addr | ||||
is | is | ||||
.Dv NULL , | .Dv NULL , | ||||
then | then | ||||
.Fn free | .Fn free | ||||
does nothing. | does nothing. | ||||
.Pp | |||||
Like | |||||
.Fn free , | |||||
the | |||||
.Fn zfree | |||||
function releases memory at address | |||||
.Fa addr | |||||
that was previously allocated by | |||||
.Fn malloc | |||||
for re-use. | |||||
However, | |||||
.Fn zfree | |||||
will zero the memory before it is released. | |||||
.Pp | .Pp | ||||
The | The | ||||
.Fn realloc | .Fn realloc | ||||
function changes the size of the previously allocated memory referenced by | function changes the size of the previously allocated memory referenced by | ||||
.Fa addr | .Fa addr | ||||
to | to | ||||
.Fa size | .Fa size | ||||
bytes. | bytes. | ||||
▲ Show 20 Lines • Show All 208 Lines • Show Last 20 Lines |