While looking into a block size mismatch problem between
Postgresql and FreeBSD's FFS, I noticed that postgresql is making
some rather odd-sized requests to malloc(3): 0x2034, 0x2020,
0x4018, 0x8018, etc. Most malloc(3) implementations round large
allocations up to a multiple of a large power of 2---often the
hardware page size, so this is a pathological case for those
allocators. For example, on a machine with 4K pages, the database
may use ~50% more memory for the 0x2034 byte allocations.
Browsing through the source, it looks like the allocation set
implementation and the buffered file implementation both use
inline tags. The latter, at least, could be easily fixed by
allocating the buffer separately, but that would only be
worthwhile if the former were also modified.
Thoughts on this particular design decision?