Split and coalesce without moving allocations

This figure documents the historical i386 source baseline. Current native x86-64/AArch64 qualification is recorded separately; this is not an ELF64 or native SMP implementation diagram.

  1. Before allocationAddress order →
    Allocated AFree BAllocated C
  2. kmallocFirst fit · align + guards · split if useful
    ANew allocationB remainderC
  3. kfreeValidate guards · merge adjacent free blocks
    ACoalesced BC

Schematic sizes · no live allocation moves. Interrupt-atomic mutation; SMP adds heap locking.

First fit consumes a suitable free block; freeing merges adjacent free neighbors.

Text equivalent and source references
  • kmalloc aligns the request, includes guard space and scans for the first suitable block. A useful remainder stays free.
  • kfree validates the block and guards, then coalesces adjacent free neighbors without relocating live allocations. Block widths are schematic, not measured sizes.

Before / during / after. Source paths refer to the atlas baseline; the kernel checkout is private.

  • kernel/core/memory.c · heap_init, kmalloc, kfree, heap_merge_next