Philip Warner <pjw@rhyme.com.au> writes:
> Can you maintain one free list for each power of 2 (which it might already
> be doing by the look of it), and always allocate the max size for the list.
> Then when you want a 10k chunk, you get a 16k chunk, but you know from the
> request size which list to go to, and anything on the list will satisfy the
> requirement.
That is how it works for small chunks (< 1K with the current
parameters). I don't think we want to do it that way for really
huge chunks though.
Maybe the right answer is to eliminate the gap between small chunks
(which basically work as Philip sketches above) and huge chunks (for
which we fall back on malloc). The problem is with the stuff in
between, for which we have a kind of half-baked approach...
regards, tom lane