On 5/20/22 12:01, Heikki Linnakangas wrote: > On 20/05/2022 08:56, David Rowley wrote: >> The problem is that generation chunks have a larger chunk header than >> aset do due to having to store the block pointer that the chunk >> belongs to so that GenerationFree() can increment the nfree chunks in >> the block. aset.c does not require this as freed chunks just go onto a >> freelist that's global to the entire context. > > Could the 'context' field be moved from GenerationChunk to GenerationBlock? >
Not easily, because GetMemoryChunkContext() expects the context to be stored right before the chunk. In principle we could add "get context" callback to MemoryContextMethods, so that different implementations can override that. I wonder how expensive the extra redirect would be, but probably not much because the places touching chunk->context deal with the block too (e.g. GenerationFree has to tweak block->nfree). regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company