Re: Fixing memory leaks in postgres_fdw

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Fixing memory leaks in postgres_fdw
Date: 2025-05-26 19:36:14
Message-ID: 918254.1748288174@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Here's a v4 that is actually more or less feature-complete:
it removes no-longer-needed complexity such as PG_TRY blocks.
I've checked that Valgrind shows no leaks in the postgres_fdw
and dblink tests after applying this on top of my other
patch series.

0001 is like the previous version except that I took out some
inessential simplifications to get to the minimum possible
patch. Then 0002 does all the simplifications. Removal of
PG_TRY blocks implies reindenting a lot of code, but I made
that a separate patch 0003 for ease of review. (0003 would
be a candidate for adding to .git-blame-ignore-revs, perhaps.)
0004 is the old 0002 (still unmodified) and then 0005 cleans
up one remaining leakage observed by Valgrind.

regards, tom lane

Attachment Content-Type Size
v4-0001-Fix-memory-leakage-in-postgres_fdw-s-DirectModify.patch text/x-diff 14.6 KB
v4-0002-Reap-the-benefits-of-not-having-to-avoid-leaking-.patch text/x-diff 33.3 KB
v4-0003-Run-pgindent-on-the-changes-of-the-previous-patch.patch text/x-diff 42.3 KB
v4-0004-Silence-leakage-complaint-about-postgres_fdw-s-In.patch text/x-diff 3.7 KB
v4-0005-Avoid-leak-when-dblink_connstr_check-fails.patch text/x-diff 1.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin K Biju 2025-05-26 19:43:59 Re: Add CHECK_FOR_INTERRUPTS in polling loop code path in XactLockTableWait
Previous Message Yugo Nagata 2025-05-26 18:17:51 Re: Prevent internal error at concurrent CREATE OR REPLACE FUNCTION