On 2014-02-11 11:22:24 -0500, Robert Haas wrote:
> + context = AllocSetContextCreate(CurrentMemoryContext,
> +
> "Changeset Extraction Context",
> +
> ALLOCSET_DEFAULT_MINSIZE,
> +
> ALLOCSET_DEFAULT_INITSIZE,
> +
> ALLOCSET_DEFAULT_MAXSIZE);
>
> I have my doubts about whether it's wise to make this the child of
> CurrentMemoryContext. Certainly, if we do that, then expectations
> around what that context is need to be documented. Short-lived
> contexts are presumably unsuitable.
Well, it depends on the type of usage. In the walsender, yes, it needs
to be a longliving context. Not so much in the SQL case, inside the SRF
we spill all the data into a tuplestore after which we are done. I don't
see which context would be more suitable as a default parent; it used to
be TopMemoryContext but that requires pointless cleanup routines to
handle errors...
So I think documenting the requirement is the best way?
I'm working on the other comments, pushing individual changes to
git. Will send a new version onlist once I'm through.
Greetings,
Andres Freund
-- Andres Freund http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services