Re: Probable memory leak with ECPG and AIX

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Noah Misch <noah@leadboat.com>
Cc: Benoit Lobréau <benoit.lobreau@gmail.com>, Guillaume Lelarge <guillaume@lelarge.info>, PostgreSQL Developers <pgsql-hackers@postgresql.org>, "Dr. Michael Meskes" <michael.meskes@credativ.com>
Date: 2022-01-01T16:35:02Z
Lists: pgsql-hackers
Noah Misch <noah@leadboat.com> 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 newlocale()
> 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



Commits

  1. Fix previous commit's ecpg_clocale for ppc Darwin.

  2. ecpglib: call newlocale() once per process.