Re: dblink memory leak - Mailing list pgsql-hackers

From Tom Lane
Subject Re: dblink memory leak
Date
Msg-id 15846.1254768804@sss.pgh.pa.us
Whole thread Raw
In response to Re: dblink memory leak  (Joe Conway <mail@joeconway.com>)
Responses Re: dblink memory leak  (Joe Conway <mail@joeconway.com>)
List pgsql-hackers
Joe Conway <mail@joeconway.com> writes:
> Given that change, is there even any leak to even worry about? As long
> as the PGresult object is created in the correct memory context, it
> ought to get cleaned up automatically, no?

No, because libpq knows nothing of backend memory contexts; it just
allocates with malloc.  You'll still need a PG_TRY block to ensure you
release PGresults during error cleanup.  The change to using tuplestores
will just help you localize that requirement in well-defined places.

> I can't promise to make this change before 15 October, but I will get to
> it before the end of CF3.

No big hurry, I think, considering the leak has always been there.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Hot Standby on git
Next
From: Josh Berkus
Date:
Subject: Re: Privileges and inheritance