.. _lifecycle: Lifecycle ========= An arena moves through four states. ``mmap`` reserves a range of virtual addresses, not yet backed by physical memory (that comes later). ``alloc()`` hands out available memory by bumping a free pointer. When available memory is exhausted, it obtains more by committing pages starting from the remaining uncommitted reserved range. ``clear()`` resets the free pointer, but keeps all committed memory. ``unmap()`` returns the entire reserved range to the kernel. The animation below runs those four phases in order, on a 32 MB reservation. What to watch for ----------------- The upper strip is the page ``free_`` currently sits in, drawn at byte resolution. This may be a (4K on linux) regular page, or a 2MB superpage. The ribbon beneath it is the whole reservation, with the current page bracketed. .. raw:: html

Open the animation in its own tab for more room.

See also :doc:`DArena-reference` for the same picture in one screenful of text, and :doc:`implementation` for how the pieces fit together.