#include <sys/malloc.h>

sys/malloc.h Kernel.framework

17 macros · 4 functions

macroM_WAITOK

flags to malloc
#define M_WAITOK 0x0000

macroM_NOWAIT

#define M_NOWAIT 0x0001

macroM_ZERO

#define M_ZERO 0x0004
bzero the allocation

macroM_NULL

#define M_NULL 0x0008
return NULL if space is unavailable

macroM_PCB

#define M_PCB 4
protocol control block (smb)

macroM_RTABLE

#define M_RTABLE 5
routing tables

macroM_IFADDR

#define M_IFADDR 9
interface address (IOFireWireIP)

macroM_SONAME

#define M_SONAME 11
socket name (smb)

macroM_LOCKF

#define M_LOCKF 40
Byte-range locking structures (msdos)

macroM_TEMP

#define M_TEMP 80
misc temporary data buffers

macroM_UDFNODE

#define M_UDFNODE 84
UDF inodes (udf)

macroM_UDFMNT

#define M_UDFMNT 85
UDF mount structures (udf)

macroM_KAUTH

#define M_KAUTH 100
kauth subsystem (smb)

macroMALLOC

#define MALLOC(space, cast, size, type, flags) (space) = (cast)_MALLOC(size, type, flags)

macroFREE

#define FREE(addr, type) _FREE((void *)addr, type)

macroMALLOC_ZONE

#define MALLOC_ZONE(space, cast, size, type, flags) (space) = (cast)_MALLOC_ZONE(size, type, flags)

macroFREE_ZONE

#define FREE_ZONE(addr, size, type) _FREE_ZONE((void *)addr, size, type)

function_MALLOC

extern void *_MALLOC(size_t size, int type, int flags)
claude-fable-5, 2026-08-23 · not from Apple sources · verified against xnu bsd/kern/kern_malloc.c
Deprecated; use IOMallocType()/kalloc_type() instead. Legacy BSD kernel allocator behind the MALLOC() macro. Allocates size bytes from the default kalloc heap; the historical malloc type is otherwise ignored except that M_SONAME selects a dedicated heap. flags: M_WAITOK block until memory is available M_NOWAIT return NULL on failure instead of blocking M_ZERO zero the allocation M_NULL return NULL rather than panicking if a blocking allocation fails Returns NULL for size 0. A blocking allocation that fails without M_NULL panics.

function_FREE

extern void _FREE(void *addr, int type)
claude-fable-5, 2026-08-23 · not from Apple sources · verified against xnu bsd/kern/kern_malloc.c
Deprecated counterpart of _MALLOC, behind the FREE() macro; frees the allocation at addr back to the default kalloc heap. The type argument is ignored. Use IOFreeType()/kfree_type() instead.

function_MALLOC_ZONE

extern void *_MALLOC_ZONE(size_t size, int type, int flags)
claude-fable-5, 2026-08-23 · not from Apple sources · verified against xnu bsd/kern/kern_malloc.c, config/BSDKernel.arm64.MacOSX.exports
Deprecated; use IOMallocType()/kalloc_type() instead. Historically allocated from a per-type zone; now exported as an alias of _MALLOC and behaves identically: allocates size bytes from the default kalloc heap, honoring M_WAITOK, M_NOWAIT, M_ZERO, and M_NULL, with the type argument ignored.

function_FREE_ZONE

extern void _FREE_ZONE(void *elem, size_t size, int type)
claude-fable-5, 2026-08-23 · not from Apple sources · verified against xnu bsd/kern/kern_malloc.c
Deprecated counterpart of _MALLOC_ZONE; frees elem, whose allocation size must be given, back to the default kalloc heap. The type argument is ignored. Use IOFreeType()/kfree_type() instead.