aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/numeric.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-12-27 22:30:48 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-12-27 22:30:48 +0000
commitc22dea89004b99af099cb31139f8aeb5bcb8840d (patch)
treed0e4507c7ba5df72800b9979f6b9d31301696fab /src/backend/utils/adt/numeric.c
parent6bb7b467c0572e4baafca5eb491aab2739e44378 (diff)
downloadpostgresql-c22dea89004b99af099cb31139f8aeb5bcb8840d.tar.gz
postgresql-c22dea89004b99af099cb31139f8aeb5bcb8840d.zip
Improve memory management code to avoid inefficient behavior when a context
has a small maxBlockSize: the maximum request size that we will treat as a "chunk" needs to be limited to fit in maxBlockSize. Otherwise we will round up the request size to the next power of 2, wasting space, which is a bit pointless if we aren't going to make the blocks big enough to fit additional stuff in them. The example motivating this is local buffer management, which makes repeated allocations of 8K (one BLCKSZ buffer) in TopMemoryContext, which has maxBlockSize = 8K because for the most part allocations there are small. This leads to each local buffer actually eating 16K of space, which adds up when there are thousands of them. I intend to change localbuf.c to aggregate its requests, which will prevent this particular misbehavior, but it seems likely that similar scenarios could arise elsewhere, so fixing the core problem seems wise as well.
Diffstat (limited to 'src/backend/utils/adt/numeric.c')
0 files changed, 0 insertions, 0 deletions