public inbox for [email protected]
help / color / mirror / Atom feedFrom: Andres Freund <[email protected]>
To: Fujii Masao <[email protected]>
Cc: Chao Li <[email protected]>
Cc: Henrik TJ <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: Fix memory leak in postmasterMain
Date: Wed, 22 Apr 2026 13:55:36 -0400
Message-ID: <mwikkx643zp3f5qmx27crf2d2ngwgupc4om4kfq4gyc6vukjom@kyimpnconhdv> (raw)
In-Reply-To: <CAHGQGwEn3oEad-wR1XoEbe1R-pB1EOycRKjEj+5Pp38mjgiF+Q@mail.gmail.com>
References: <[email protected]>
<[email protected]>
<[email protected]>
<CAHGQGwEn3oEad-wR1XoEbe1R-pB1EOycRKjEj+5Pp38mjgiF+Q@mail.gmail.com>
Hi,
On 2026-04-23 00:29:29 +0900, Fujii Masao wrote:
> On Wed, Apr 22, 2026 at 3:46 PM Chao Li <[email protected]> wrote:
> >
> > From my experience, most of the time the postmaster is started with -D. On Linux and macOS, that path can be quite long, PATH_MAX is often 4096 on many Unix-like systems, and I am not sure about Windows. So I think this leak is worth fixing.
>
> We can also free()/pfree() userDoption in postgres.c and bootstrap.c?
>
> Since userDoption typically uses only a small amount of memory, I'm not sure
> this patch provides much practical benefit from a memory-leak perspective.
I don't think this is a leak at all. We *never* can reach the end of the scope
in which userDoption is allocated. We abort() if the end of PostmasterMain()
is ever reached. What is the leak here supposed to actually be?
> So I don't think it needs to be backpatched to the stable branches.
Definitely not.
> OTOH, if it helps keep Valgrind quiet for userDoption, I may be ok with
> applying it to master.
I'm doubtful it makes sense to fix it this way.
If we do it, we should actually be a bit more systematic and also free
output_config_variable.
ISTM those strdup()s should actually be pstrdup()s? I suspect changing that
would also silence valgrind.
Greetings,
Andres Freund
view thread (7+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: Fix memory leak in postmasterMain
In-Reply-To: <mwikkx643zp3f5qmx27crf2d2ngwgupc4om4kfq4gyc6vukjom@kyimpnconhdv>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox