Download INTRO (9) NetBSD Kernel Developer`s Manual INTRO (9
Transcript
MALLOC (9) NetBSD Kernel Developer’s Manual MALLOC (9) NAME malloc, MALLOC, realloc, free, FREE, malloc_roundup, malloc_type_attach, malloc_type_detach, malloc_type_setlimit, MALLOC_DEFINE_LIMIT, MALLOC_DEFINE, MALLOC_DECLARE — general-purpose kernel memory allocator SYNOPSIS #include <sys/malloc.h> void ∗ malloc(unsigned long size , struct malloc_type ∗type , int flags); MALLOC(space , cast , unsigned long size , struct malloc_type ∗type , int flags); void ∗ realloc(void ∗addr , unsigned long newsize , struct malloc_type ∗type , int flags); void free(void ∗addr , struct malloc_type ∗type); FREE(void ∗addr , struct malloc_type ∗type); unsigned long malloc_roundup(unsigned long size); void malloc_type_attach(struct malloc_type ∗type); void malloc_type_detach(struct malloc_type ∗type); void malloc_type_setlimit(struct malloc_type ∗type , unsigned long limit); #include <sys/mallocvar.h> MALLOC_DEFINE_LIMIT(type , shortdesc , longdesc , limit); MALLOC_JUSTDEFINE_LIMIT(type , shortdesc , longdesc , limit); MALLOC_DEFINE(type , shortdesc , longdesc); MALLOC_JUSTDEFINE(type , shortdesc , longdesc); MALLOC_DECLARE(type); DESCRIPTION These interfaces are being obsoleted and their new use is discouraged. For new code, please consider to use kmem_alloc(9) or pool_cache(9) instead. The malloc() function allocates uninitialized memory in kernel address space for an object whose size is specified by size. malloc_roundup() returns the actual size of the allocation unit for the given value. free() releases memory at address addr that was previously allocated by malloc() for re-use. Unlike free(3), free() does not accept an addr argument that is NULL. The realloc() function changes the size of the previously allocated memory referenced by addr to size and returns a pointer to the ( possibly moved ) object. The memory contents are unchanged up to the lesser of the new and old sizes. If the new size is larger, the newly allocated memory is uninitialized. If the requested memory cannot be allocated, NULL is returned and the memory referenced by addr is unchanged. If addr is NULL, then realloc() behaves exactly as malloc(). If the new size is 0, then realloc() NetBSD 3.0 March 24, 2008 1
Related documents
Virtual Console FCD-CFxx System information
Core Networking Stack User's Guide:
Configuration File Management on EX Series
A File System Component Compiler
DSP4000 User Manual Rusty update 21Jan2012
Building TEX Live (2015)
GSX Server User`s Manual - Support On Line
IRIX® 6.3 for O2™ Device Driver Programming Guide
Help File (PDF: 583 KB)
as a PDF
KoreWifi - K-Team FTP area
KTelnet User Manual - Stacken