Philip Warner <pjw(at)rhyme(dot)com(dot)au> writes:
> Is it simple for the person writing the low level routines to choose
> (easily) to allocate 'temporary' memory vs. 'permanent' memory?
One of the main problems is that a low-level routine doesn't necessarily
know which is appropriate --- the answer may vary depending on where it
was called from. To do it that way, I think we'd end up decorating a
large number of internal APIs with extra MemoryContext arguments.
(This is exactly why we have a global CurrentMemoryContext in the first
place...)
That's why I wanted to do the management at the level of the Plan node
executor routines, which are high-level enough that they have some clue
what's going on.
regards, tom lane