Largest free memory block
ID: largest-free-memory-block
The largest free memory block is the longest contiguous free region available within a specified allocation pool and address space. If free-block lengths are ,For an empty free-block set, take . The largest block and total free capacity answer different questions: a contiguous request can fail even when exceeds its size. This is the central layout issue in external memory fragmentation.[ref]
Operating Systems: Three Easy Pieces by Remzi H. Arpaci-Dusseau and others. Chapter17 introduction, fragmented free capacity versus one contiguous allocation; §17.2, adjacent-block merging
For free lengths24,40 and16 bytes, bytes and bytes. A48-byte contiguous request fails in that fixed, nonmoving pool before metadata and memory alignment are considered. Coalescing an additional freed separator can increase without requiring the allocator to obtain another region from the operating system.
Raw extent length can overstate payload capacity. For a block , an illustrative header requirement and payload alignment , choose aligned payload startThe aligned free-block capacity in this simple layout is . A32-byte block starting at0 with an8-byte header and16-byte payload alignment has and only16 bytes of payload capacity. A24-byte payload therefore fails despite a raw32-byte extent. Actual allocator layouts can impose further constraints.
The quantity also depends on the allocation layer. A large virtually contiguous block need not occupy contiguous physical page frames. Comparing values without specifying virtual versus physical space, allocator pool and usable payload convention can therefore mix distinct fragmentation problems.
New to topics? Read the docs here!