Re: pg_upgrade: fix memory leak in SLRU I/O code

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_upgrade: fix memory leak in SLRU I/O code
Date: 2026-02-05 05:28:54
Message-ID: aYQqllw9Rjq5lfLX@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Feb 05, 2026 at 01:02:08PM +0800, Chao Li wrote:
> My concern is more about the pattern: freeing the container
> structure while leaving its members allocated. That feels
> inconsistent and potentially confusing to readers. Either owning
> objects should be fully freed, or not freed at all, but partial
> freeing doesn’t seem like a great precedent. I’m not sure that’s a
> pattern we want to encourage in PG code.

For one-time allocations that are freed once we exit the binary, I
would not have bothered about freeing the state, TBH. Closing the fd
in these two paths is a good thing, though.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Shlok Kyal 2026-02-05 05:29:06 Re: Skipping schema changes in publication
Previous Message Ajin Cherian 2026-02-05 05:03:13 Re: [PATCH] Support automatic sequence replication