Re: [bug fix] Memory leak in dblink - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [bug fix] Memory leak in dblink
Date
Msg-id 11929.1403147997@sss.pgh.pa.us
Whole thread Raw
In response to Re: [bug fix] Memory leak in dblink  (Joe Conway <mail@joeconway.com>)
Responses Re: [bug fix] Memory leak in dblink  (Joe Conway <mail@joeconway.com>)
List pgsql-hackers
Joe Conway <mail@joeconway.com> writes:
> On a side note, while perusing this section of code:

> 8<-------------------------- at dblink.c:1176 --------------------------
>  /* make sure we have a persistent copy of the tupdesc */
>  tupdesc = CreateTupleDescCopy(tupdesc);

> Shouldn't that CreateTupleDescCopy() happen in ecxt_per_query_memory?

Not necessary (we'd have seen crashes long since if it was).
ExecMakeTableFunctionResult doesn't need the tupdesc to persist past
return.

Actually, I was wondering whether we couldn't remove that
CreateTupleDescCopy call entirely.  The risk would be if
get_call_result_type returned a pointer into relcache or some other cached
tuple descriptor, which might be subject to a cache flush --- but AFAICS
it always returns a freshly created or copied tupdesc.  (This might not
have been true originally, which could explain why dblink thinks it needs
to copy.)
        regards, tom lane



pgsql-hackers by date:

Previous
From: Ian Barwick
Date:
Subject: Re: Possible index issue on 9.5 slave
Next
From: Peter Geoghegan
Date:
Subject: Re: Possible index issue on 9.5 slave