Link

Memory

Table of contents

  1. TOC

Allocating

kmalloc(), kzalloc(), kmalloc_array(), kcalloc(), vmalloc(), and vzalloc()

p = kmalloc(sizeof(*p), ...);
p = kmalloc_array(n, sizeof(...), ...);
p = kcalloc(n, sizeof(...), ...);   // zeroed array
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))