From: Stephen Frost <sfrost@snowman.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Andres Freund <andres@2ndquadrant.com>
Cc: Heikki Linnakangas <hlinnakangas@vmware.com>
Cc: Naoya Anzai <anzai-naoya@mxu.nes.nec.co.jp>
Cc: pgsql-bugs@postgresql.org
Cc: Akio Iwaasa <iwaasa@mxs.nes.nec.co.jp>
Subject: Re: Memory-leak in BackgroundWriter(and Checkpointer)
Date: Tue, 4 Jun 2013 14:05:25 -0400
Message-ID: <20130604180525.GK5871@tamriel.snowman.net> (raw)
In-Reply-To: <28228.1370368383@sss.pgh.pa.us>
References: <E4CE60F76BA483anzai-naoya@mxu.nes.nec.co.jp>
<20130604122736.GH5871@tamriel.snowman.net>
<51ADEA34.4080704@vmware.com>
<20130604132758.GC2854@alap2.anarazel.de>
<20130604134927.GI5871@tamriel.snowman.net>
<28228.1370368383@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
* Tom Lane (tgl@sss.pgh.pa.us) wrote:
> Meh. I'm not impressed with permanently allocating an array large
> enough to hold all the locks GetRunningTransactionLocks
> might return --- that's potentially much larger than the other array,
> and in fact I don't think we have a hard limit on its size at all.
Well, sure, which is why I didn't actually do that- but I did end up
having to make it resize when necessary, which isn't entirely ideal
either.
> Besides which, it's not like there is *no* cleanup for
> GetRunningTransactionData --- it has a lock that has to be released ...
That's true.. I guess my general feeling is that it'd be good to do
this all one way or the other- having it use a static variable into
which we stick the pointer to some reused space for one and then doing a
palloc for the other which needs to be pfree'd struck me as odd.
> I think the proposed fix is fine code-wise; the real problem here is
> crummy commenting. GetRunningTransactionLocks isn't documented as
> returning a palloc'd array, and why the heck do we have a long comment
> about its implementation in LogStandbySnapshot?
Certainly good questions and better comments would have helped here. I
can go back and rework the patch either way.
Thanks,
Stephen
Attachments:
signature.asc (application/pgp-signature, 197B) 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-bugs@postgresql.org
Cc: sfrost@snowman.net, tgl@sss.pgh.pa.us, andres@2ndquadrant.com, hlinnakangas@vmware.com, anzai-naoya@mxu.nes.nec.co.jp, iwaasa@mxs.nes.nec.co.jp
Subject: Re: Memory-leak in BackgroundWriter(and Checkpointer)
In-Reply-To: <20130604180525.GK5871@tamriel.snowman.net>
References: <E4CE60F76BA483anzai-naoya@mxu.nes.nec.co.jp> <20130604122736.GH5871@tamriel.snowman.net> <51ADEA34.4080704@vmware.com> <20130604132758.GC2854@alap2.anarazel.de> <20130604134927.GI5871@tamriel.snowman.net> <28228.1370368383@sss.pgh.pa.us> <20130604180525.GK5871@tamriel.snowman.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