First page
Back
Continue
Last page
Overview
Graphics
kmalloc API
#include <linux/slab.h>
void *kmalloc(size_t size, int flags);
Allocate size bytes, and return a pointer to the area (virtual address)
size
: number of bytes to allocate
flags
: same flags as the page allocator
void kfree (const void *objp);
Free an allocated area
Example: (
drivers/infiniband/core/cache.c
)
struct ib_update_work *work; work = kmalloc(sizeof *work, GFP_ATOMIC); ...
kfree(work);