Btw, when I wrote this > - When palloc() requests some mem, see if there's any block with > enough unused room to handle it. If so, allocate in that block.
... I didn't specify whether one should use the block with the smallest free space that still satisfies the request, or the largest, or some other algorithm. Frankly I'm not sure how fragmentation plays out in real life :-). My instinct would be take the smallest and just live with the little bits of unused memory, but maybe in practice it turns out to be better to take the largest, so one still has a significant amount left over in that block even after the allocation? -K
