Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n3hML-0007Hm-0C for pgsql-hackers@arkaria.postgresql.org; Sat, 01 Jan 2022 16:35:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n3hLm-0006LQ-FX for pgsql-hackers@arkaria.postgresql.org; Sat, 01 Jan 2022 16:35:22 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n3hLm-0006LH-6c for pgsql-hackers@lists.postgresql.org; Sat, 01 Jan 2022 16:35:22 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n3hLj-0000Ak-AS for pgsql-hackers@postgresql.org; Sat, 01 Jan 2022 16:35:20 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 201GZ2q52865640; Sat, 1 Jan 2022 11:35:02 -0500 From: Tom Lane To: Noah Misch cc: Benoit =?iso-8859-1?Q?Lobr=E9au?= , Guillaume Lelarge , PostgreSQL Developers , "Dr. Michael Meskes" Subject: Re: Probable memory leak with ECPG and AIX In-reply-to: <20220101074055.GA54621@rfd.leadboat.com> References: <20211212073411.GA2218865@rfd.leadboat.com> <20220101074055.GA54621@rfd.leadboat.com> Comments: In-reply-to Noah Misch message dated "Fri, 31 Dec 2021 23:40:55 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2865638.1641054902.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sat, 01 Jan 2022 11:35:02 -0500 Message-ID: <2865639.1641054902@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Noah Misch writes: > I get the same results. The leak arises because AIX freelocale() doesn'= t free > all memory allocated in newlocale(). The following program uses trivial > memory on GNU/Linux, but it leaks like you're seeing on AIX: Bleah. > If you have access to file an AIX bug, I recommend doing so. If we want > PostgreSQL to work around this, one idea is to have ECPG do this newloca= le() > less often. For example, do it once per process or once per connection > instead of once per ecpg_do_prologue(). It's worse than that: see also ECPGget_desc(). Seems like a case could be made for doing something about this just on the basis of cycles expended, never mind freelocale() bugs. regards, tom lane