Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Ujvby-00048B-Lq for pgsql-bugs@arkaria.postgresql.org; Tue, 04 Jun 2013 18:05:34 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1Ujvby-0005IU-6W for pgsql-bugs@arkaria.postgresql.org; Tue, 04 Jun 2013 18:05:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Ujvbx-0005IP-Iv for pgsql-bugs@postgresql.org; Tue, 04 Jun 2013 18:05:33 +0000 Received: from cl-262.qas-01.us.sixxs.net ([2001:4830:1600:105::2] helo=tamriel.snowman.net) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Ujvbq-0006vU-In for pgsql-bugs@postgresql.org; Tue, 04 Jun 2013 18:05:33 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id E74B3222DF; Tue, 4 Jun 2013 14:05:25 -0400 (EDT) Date: Tue, 4 Jun 2013 14:05:25 -0400 From: Stephen Frost To: Tom Lane Cc: Andres Freund , Heikki Linnakangas , Naoya Anzai , pgsql-bugs@postgresql.org, Akio Iwaasa Subject: Re: Memory-leak in BackgroundWriter(and Checkpointer) Message-ID: <20130604180525.GK5871@tamriel.snowman.net> References: <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> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="aYrjF+tKt+ApYAdb" Content-Disposition: inline In-Reply-To: <28228.1370368383@sss.pgh.pa.us> X-Editor: Vim http://www.vim.org/ X-Info: http://www.snowman.net X-Operating-System: Linux/3.2.0-4-amd64 (x86_64) X-Uptime: 14:03:04 up 1 day, 17:41, 5 users, load average: 0.14, 0.14, 0.13 User-Agent: Mutt/1.5.21 (2010-09-15) X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org --aYrjF+tKt+ApYAdb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline * 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 --aYrjF+tKt+ApYAdb Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlGuLGUACgkQrzgMPqB3kiiPkgCfftx0K2gxhmSnLOJIx1n9/Kkb 1q0Anj5RU9ZQ7lXS6QxRxB5iYj1A/VXP =jKMr -----END PGP SIGNATURE----- --aYrjF+tKt+ApYAdb--