From: | Matheus Alcantara <matheusssilv97(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: Fixing memory leaks in postgres_fdw |
Date: | 2025-05-27 20:45:17 |
Message-ID: | CAFY6G8fEa9sZ1V9cJpMOZAp6Wfa35U_rE0Y=eoQLS2G3OAqiAw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
On 26/05/25 16:36, Tom Lane wrote:
> 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
>
The v4-0001-Fix-memory-leakage-in-postgres_fdw-s-DirectModify.patch
looks good to me.
Just some thoughts on v4-0005-Avoid-leak-when-dblink_connstr_check-fails.patch:
I think that we can delay the allocation a bit more. The
dblink_security_check just use the rconn to pfree in case of a failure,
so I think that we can remove this parameter and move the rconn
allocation to the next if (connname) block. See attached as an example.
--
Matheus Alcantara
Attachment | Content-Type | Size |
---|---|---|
delay-rconn-allocation.diff | application/octet-stream | 3.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Euler Taveira | 2025-05-27 21:22:59 | Re: Clarification on warning when connecting to 'pgbouncer' database via Pgbouncer |
Previous Message | Nathan Bossart | 2025-05-27 20:02:52 | Re: Large expressions in indexes can't be stored (non-TOASTable) |