pgsql: Silence complaints about leaks in PlanCacheComputeResultDesc.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Silence complaints about leaks in PlanCacheComputeResultDesc.
Date: 2025-08-03 02:00:50
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Silence complaints about leaks in PlanCacheComputeResultDesc.

CompleteCachedPlan intentionally doesn't worry about small
leaks from PlanCacheComputeResultDesc. However, Valgrind
knows nothing of engineering tradeoffs and complains anyway.
Silence it by doing things the hard way if USE_VALGRIND.

I don't really love this patch, because it makes the handling
of plansource->resultDesc different from the handling of query
dependencies and search_path just above, which likewise are willing
to accept small leaks into the cached plan's context. However,
those cases aren't provoking Valgrind complaints. (Perhaps in a
CLOBBER_CACHE_ALWAYS build, they would?) For the moment, this
makes the src/pl/plpgsql tests leak-free according to Valgrind.

Author: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Reviewed-by: Andres Freund <andres(at)anarazel(dot)de>
Discussion: https://postgr.es/m/[email protected]

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b102c8c4733cf76ff0635dc440ee8dd11487ed95

Modified Files
--------------
src/backend/utils/cache/plancache.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2025-08-03 17:01:59 pgsql: Take a little more care in set_backtrace().
Previous Message Fujii Masao 2025-08-03 01:55:01 pgsql: Fix assertion failure in pgbench when handling multiple pipeline