MEMORYALLOCATORS(9)    NetBSD Kernel Developer's Manual    MEMORYALLOCATORS(9)

     memoryallocators -- introduction to kernel memory allocators

     The NetBSD kernel provides several memory allocators, each with different
     characteristics and purpose.  This document summarizes the main differ-
     ences between them.

   The Malloc Allocator
     The malloc(9) allocator can be used for variable-sized allocations in the
     kernel address space.  It is interrupt-safe, requires no setup (see
     below), and is considered to be stable (given the number of years it has
     been in the kernel).

     This interface also allows associating a ``type'' with an allocation to
     indicate what subsystem is using the memory allocated, thus providing
     statistics as to the memory usage of different kernel subsystems.  To
     define a type, one should use the MALLOC_DEFINE macro, otherwise, one of
     the built-in types, like M_TEMP can be used.

     See malloc(9) for more details.

   The Kmem Allocator
     The kmem allocator is modelled after an interface of similar name imple-
     mented in Solaris, and is under active development.

     It is implemented on-top of the vmem(9) resource allocator (beyond the
     scope of this document), meaning it will be using pool_cache(9) inter-
     nally to speed-up common (small) sized allocations.

     Like malloc(9), it requires no setup, but can't be used yet from inter-
     rupt context.

     See kmem_alloc(9), kmem_zalloc(9), and kmem_free(9) for more details.

   The Pool Allocator
     The pool(9) allocator is a fixed-size memory allocator.  It requires set-
     up (to initialize a memory pool) and is interrupt-safe.

     See pool(9) for more details.

   The Pool Cache Allocator
     The pool cache allocator works on-top of the pool(9) allocator, also
     allowing fixed-size allocation only, requires setup, and is interrupt-

     The pool cache allocator is expected to be faster than other allocators,
     including the ``normal'' pool allocator.

     In the future this allocator is expected to have a per-CPU cache.

     See pool_cache(9) for more details.

   The UVM Kernel Memory Allocator
     This is a low-level memory allocator interface.  It allows variable-sized
     allocations in multiples of PAGE_SIZE, and can be used to allocate both
     wired and pageable kernel memory.

     See uvm(9) for more details.

     free(9), intro(9), kmem_alloc(9), kmem_free(9), kmem_zalloc(9),
     malloc(9), pool(9), pool_cache(9), uvm(9), vmem(9)

     Elad Efrat <>
     YAMAMOTO Takashi <>

NetBSD 5.1                      January 7, 2007                     NetBSD 5.1

You can also request any man page by name and (optionally) by section:


Use the DEFAULT collection to view manual pages for third-party software.

©1994 Man-cgi 1.15, Panagiotis Christias
©1996-2018 Modified for NetBSD by Kimmo Suominen