memory allocation and powers of two - Mailing list pgsql-hackers

From David Schultz
Subject memory allocation and powers of two
Date
Msg-id 20030828091405.GA39540@HAL9000.homeunix.com
Whole thread Raw
Responses Re: memory allocation and powers of two
Re: memory allocation and powers of two
List pgsql-hackers
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?


pgsql-hackers by date:

Previous
From: Jeroen Ruigrok/asmodai
Date:
Subject: Weird constraint output
Next
From: Tom Lane
Date:
Subject: Re: Index creation takes for ever