At 10:08 10/07/00 -0400, Tom Lane wrote:
>Philip Warner <pjw@rhyme.com.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.
...
>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.
ISTM (with, perhaps, no basis (ISTMWPNB?)) that when allocating memory
there are a couple of cases:
You want it to be available:
1. until the end of the current call
2. at least until the next call
3. until TX end
4. forever
...etc.
If there are still cases where the called routine can't tell what sort of
memory it wants, then my method won't work (and I'd be interested to know
what they are).
But if a relatively short list of allocation types can be created, then the
palloc replacement can be passed an extra parameter (the 'allocation
type'), and handle memory contexts appropriately.
Feel free to tell me if this is so way off the mark that there is no
purpose in pursuing the discussion...
----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.C.N. 008 659 498) | /(@) ______---_
Tel: (+61) 0500 83 82 81 | _________ \
Fax: (+61) 0500 83 82 82 | ___________ |
Http://www.rhyme.com.au | / \| | --________--
PGP key available upon request, | /
and from pgp5.ai.mit.edu:11371 |/