BuddySystemAllocator
BuddySystemAllocator is a memory allocator that uses the buddy memory allocation algorithm to manage a contiguous pool of memory. Blocks are sized in powers of two, and each block has a unique buddy of the same size. When both buddies are free they can be coalesced into a larger block, and this process repeats up the size hierarchy to form larger free blocks as needed.
Allocation proceeds by rounding the requested size up to the next power of two and selecting the
Deallocation checks the block’s buddy; if the buddy is free, the two are merged to form a
Advantages include predictable, logarithmic-time allocations and deallocations and bounded external fragmentation. Limitations include internal fragmentation due
In practice, BuddySystemAllocator appears in operating system kernels, embedded systems, and custom memory pools where memory