malloc_type Structures
The malloc
, free
, realloc
, and reallocf
functions include a type
argument, which expects a pointer to a malloc_type
structure; this structure describes the purpose of the allocated memory. The type
argument has no impact on performance; it is used for memory profiling and for basic sanity checks.
Note
You can profile kernel dynamic memory usage, sorted by type
, with the vmstat -m
command.
MALLOC_DEFINE Macro
The MALLOC_DEFINE
macro defines a new malloc_type
structure. Here is its function prototype:
#include <sys/param.h> #include <sys/malloc.h> #include <sys/kernel.h> MALLOC_DEFINE(type, shortdesc, longdesc);
The type
argument is the new malloc_type
structure’s name. In general, type
should begin with M_
and be in uppercase letters; ...
Get FreeBSD Device Drivers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.