Improve aset.c's space management in contexts with small maxBlockSize.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 2 May 2011 16:08:08 +0000 (12:08 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 2 May 2011 16:08:08 +0000 (12:08 -0400)
commit6755558b92748287e961fed518c14be375630464
tree75c34045a4660d8115b4a3d968b750ee165f7615
parent5c436a79e0f4e11f80c5878a0309ce60f79e17b1
Improve aset.c's space management in contexts with small maxBlockSize.

The previous coding would allow requests up to half of maxBlockSize to be
treated as "chunks", but when that actually did happen, we'd waste nearly
half of the space in the malloc block containing the chunk, if no smaller
requests came along to fill it.  Avoid this scenario by limiting the
maximum size of a chunk to 1/8th maxBlockSize, so that we can waste no more
than 1/8th of the allocated space.  This will not change the behavior at
all for the default context size parameters (with large maxBlockSize),
but it will change the behavior when using ALLOCSET_SMALL_MAXSIZE.

In particular, there's no longer a need for spell.c to be overly concerned
about the request size parameters it uses, so remove a rather unhelpful
comment about that.

Merlin Moncure, per an idea of Tom Lane's
src/backend/tsearch/spell.c
src/backend/utils/mmgr/aset.c