Re: Fix memory leak in postmasterMain - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: Fix memory leak in postmasterMain
Date
Msg-id CAHGQGwEn3oEad-wR1XoEbe1R-pB1EOycRKjEj+5Pp38mjgiF+Q@mail.gmail.com
Whole thread
In response to Re: Fix memory leak in postmasterMain  (Chao Li <li.evan.chao@gmail.com>)
Responses Re: Fix memory leak in postmasterMain
List pgsql-hackers
On Wed, Apr 22, 2026 at 3:46 PM Chao Li <li.evan.chao@gmail.com> 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.
So I don't think it needs to be backpatched to the stable branches.

OTOH, if it helps keep Valgrind quiet for userDoption, I may be ok with
applying it to master.

Regards,

--
Fujii Masao



pgsql-hackers by date:

Previous
From: Fabrízio de Royes Mello
Date:
Subject: Re: RFC: pg_stat_logmsg
Next
From: vignesh C
Date:
Subject: Re: StringInfo fixes, v19 edition. Plus a few oddities