From: Tom Lane <tgl@sss.pgh.pa.us>
To: hghwng@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16348: Memory leak when parsing config
Date: Tue, 07 Apr 2020 11:22:28 -0400
Message-ID: <29582.1586272948@sss.pgh.pa.us> (raw)
In-Reply-To: <16348-018c10b6fd16ebcc@postgresql.org>
References: <16348-018c10b6fd16ebcc@postgresql.org>
PG Bug reporting form <noreply@postgresql.org> writes:
> ANALYSIS:
> When parsing config file, gui-file.l:ProcessConfig sets up memory context.
> It invokes guc-file.l:ProcessConfigFileInternal, which is expected to leak
> memory. It's okay because the leaked memory will be freed when cleaning up
> the context. Next, guc-file.l:ProcessConfigFileInternal associates each
> config item with filename by calling guc.c:set_config_option, which calls
> guc.c:guc_strdup. However, guc.c:guc_strdup is not aware of the memory
> context, and invokes libc.so:strdup directly.
And?
The places that use guc_strdup are expecting that the values will be
tracked and then freed when discarded. Perhaps there is a code path
where that's not happening, but you haven't either shown it or given
any reason to believe one exists.
As a quick cross-check, I set up a shell loop to send a constant stream
of SIGHUPs to an idle backend. I don't see any change in the backend's
memory consumption in "top". Maybe this test case is missing some
necessary factor ... but, again, you haven't given a reason to believe
there is one.
regards, tom lane
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: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, hghwng@gmail.com, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16348: Memory leak when parsing config
In-Reply-To: <29582.1586272948@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox