allocate-page-prefers-free-list

Status: IN

`allocate_page` always recycles from the free list before extending the file with a new page, keeping the data file compact after deletions

Source: entries/2026/05/28/b-tree-storage-engine-btree-allocate_page.md

Example

if free_head != NO_SIBLING:
    page_num = free_head  # reuse freed page
    new_head = struct.unpack(">I", page_data[HEADER_SIZE:HEADER_SIZE+4])[0]
else:
    page_num = next_free  # allocate at end

JSON