From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jon Erdman <jon@thewickedtribe.net>
Cc: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Subject: Re: valgrind a background worker
Date: Fri, 10 Feb 2023 14:56:21 -0500
Message-ID: <86420.1676058981@sss.pgh.pa.us> (raw)
In-Reply-To: <010101863c80f496-4bebe323-cb8a-4ac6-b1ae-b197a7fc70ba-000000@us-west-2.amazonses.com>
References: <4076400.1676041432@sss.pgh.pa.us>
<D0039023-2F37-437A-A644-CD10E908E703@thewickedtribe.net>
<010101863c80f496-4bebe323-cb8a-4ac6-b1ae-b197a7fc70ba-000000@us-west-2.amazonses.com>
=?UTF-8?Q?Jon_Erdman?= <jon@thewickedtribe.net> writes:
> I’m suspecting that the leak might be coming from initStringInfo(), as I see a palloc() in there and no associated pfree() in my background worker’s code, but looking at the elog backend code, it looks like maybe you only have to explicitly free buf if you relocate it larger?
Usually it's more like "you need to pfree if you allocated in a long-lived
memory context". elog is working in ErrorContext which it expects will
be reset when the dust settles.
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, jon@thewickedtribe.net
Subject: Re: valgrind a background worker
In-Reply-To: <86420.1676058981@sss.pgh.pa.us>
References: <4076400.1676041432@sss.pgh.pa.us> <D0039023-2F37-437A-A644-CD10E908E703@thewickedtribe.net> <010101863c80f496-4bebe323-cb8a-4ac6-b1ae-b197a7fc70ba-000000@us-west-2.amazonses.com> <86420.1676058981@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