From: Karl Denninger <karl@denninger.net>
To: pgsql-general@lists.postgresql.org
Subject: Re: Libpq question related to allocated resources
Date: Sat, 2 Jul 2022 14:30:52 -0400
Message-ID: <950bc06e-c5aa-f11e-1195-901e6bd17bad@denninger.net> (raw)
In-Reply-To: <2246456.1656386557@sss.pgh.pa.us>
References: <5cb156e4-0c40-d66e-5fcd-94556f58bb2b@denninger.net>
<2246456.1656386557@sss.pgh.pa.us>
On 6/27/2022 23:22, Tom Lane wrote:
> Karl Denninger<karl@denninger.net> writes:
>> But -- I still have a /lot /of memory out on the heap according to
>> jemalloc stats that is not being deallocated, and what's worse is that
>> if I rig the code to call PQfinish and then PQconnect once again I get
>> /even more /imbalanced allocate/free counts (and the memory use in said
>> buckets to go with them.)
> Hmmm ... I'm not aware of any memory leaks in libpq, but that doesn't
> mean there are none. Of course, if you're forgetting to PQclear()
> some PGresults, that's not libpq's fault ;-).
To follow up on this a bit my investigation is not yet complete /but /I
have constructed some truly-hideous worst-case test code that I can have
execute under valgrind but using the same basic codebase for everything
else (that is, outside of the FastCGI() wrapper loop) and I've not been
able to get libpq to misbehave. Everything it grabs it gives back as it
should.
I've tentatively concluded that the FastCGI wrapper code is doing this
and the fault is likely mine (perhaps due to documentation on using it
that is less-than-complete) although I've not yet conclusively
determined what it is.
Wanted to follow up with what I had found since I did make the request....
--
Karl Denninger
karl@denninger.net
/The Market Ticker/
/[S/MIME encrypted email preferred]/
Attachments:
smime.p7s (application/pkcs7-signature, 4.8K) download
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: karl@denninger.net
Subject: Re: Libpq question related to allocated resources
In-Reply-To: <950bc06e-c5aa-f11e-1195-901e6bd17bad@denninger.net>
References: <5cb156e4-0c40-d66e-5fcd-94556f58bb2b@denninger.net> <2246456.1656386557@sss.pgh.pa.us> <950bc06e-c5aa-f11e-1195-901e6bd17bad@denninger.net>
* 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