previousupnext

3.2.2 Block Split

A block-split operation is performed when the allocator finds a free block a lot larger than the requested allocation size. The allocator takes the first portion of the free block and inserts a descriptor for the remaining fragment into the list. A block pointed to by a descriptor with a non-zero penult field (normally the last block) may not be split.


The allocator sets (BTS) the allocd flag of the descriptor corresponding to the block. It obtains a new descriptor to represent the fragment and chains it into the list directly following the original descriptor; the new descriptor has the allocd flag set at this stage. When it has finished manipulating the list, the allocator clears the allocd flag of the new descriptor and returns the addr field of the original descriptor to the calling program.