Tomas Vondra <tomas.vondra@enterprisedb.com> writes:
> IMHO the idea of having a general purpose memory context and then also
> specialized memory contexts for particular allocation patterns is great,
> and we should embrace it. Adding more and more special cases into
> AllocSet seems to go directly against that idea, makes the code more
> complex, and I don't quite see how is that better or easier to use than
> having a separate BumpContext ...
I agree with this completely. However, the current design for chunk
headers is mighty restrictive about how many kinds of contexts we can
have. We need to open that back up.
Could we move the knowledge of exactly which context type it is out
of the per-chunk header and keep it in the block header? This'd
require that every context type have a standardized way of finding
the block header from a chunk. We could repurpose the existing
MemoryContextMethodID bits to allow having a small number of different
ways, perhaps.
regards, tom lane