Re: Fix memory leak when output postgres_fdw's "Relations" - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Fix memory leak when output postgres_fdw's "Relations"
Date
Msg-id YP4aOiSzpuw3aiCR@paquier.xyz
Whole thread Raw
In response to Re: Fix memory leak when output postgres_fdw's "Relations"  (Ranier Vilela <ranier.vf@gmail.com>)
List pgsql-hackers
On Fri, Jul 23, 2021 at 04:20:37PM -0300, Ranier Vilela wrote:
> Maybe not yet. Valgrind may also don't understand yet.

I think that you should do things the opposite way.  In short, instead
of attempting to understand first Valgrind or Coverity and then
Postgres, try to understand the internals of Postgres first and then
interpret what Valgrind or even Coverity tell you.

Tom is right.  There is no point in caring about the addition some
pfree()'s in the backend code as long as they don't prove to be an
actual leak in the context where a code path is used, and nobody will
follow you on that.  Some examples where this would be worth caring
about are things like tight loops leaking a bit of memory each time
these are taken, with leaks that can be easily triggered by the user
with some specific SQL commands, or even memory contexts not cleaned
up where they should, impacting some parts of the system (like the
executor, or even the planner) for a long-running analytical query.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: "tanghy.fnst@fujitsu.com"
Date:
Subject: RE: Added schema level support for publication.
Next
From: Michael Paquier
Date:
Subject: Re: Removing "long int"-related limit on hash table sizes