Re: SRF memory leaks - Mailing list pgsql-patches

From Tom Lane
Subject Re: SRF memory leaks
Date
Msg-id 20396.1203991229@sss.pgh.pa.us
Whole thread Raw
In response to SRF memory leaks  (Neil Conway <neilc@samurai.com>)
Responses Re: SRF memory leaks
List pgsql-patches
Neil Conway <neilc@samurai.com> writes:
>           if (funcTupdesc)
> +         {
>               tupledesc_match(node->tupdesc, funcTupdesc);
> +             FreeTupleDesc(funcTupdesc);
> +         }
>       }

I find this part of the patch to be a seriously bad idea.
nodeFunctionscan has no right to assume that the function has returned
an expendable tupdesc; indeed, I would think that the other case is
more nearly what's expected by the API for SRFs.  We certainly daren't
backpatch such a change.

A safer fix would be to try to make the tupdesc be in the new
multi_call_ctx when it's being created by the funcapi.c code.

            regards, tom lane

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: Fix pgstatindex using for large indexes
Next
From: Tom Lane
Date:
Subject: Re: Shlib exports file refactoring