Re: Probable memory leak with ECPG and AIX
Guillaume Lelarge <guillaume@lelarge.info>
From: Guillaume Lelarge <guillaume@lelarge.info>
To: Noah Misch <noah@leadboat.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Benoit Lobréau <benoit.lobreau@gmail.com>, PostgreSQL Developers <pgsql-hackers@postgresql.org>, "Dr. Michael Meskes" <michael.meskes@credativ.com>
Date: 2022-03-25T09:40:51Z
Lists: pgsql-hackers
Le dim. 2 janv. 2022 à 01:07, Noah Misch <noah@leadboat.com> a écrit : > On Sat, Jan 01, 2022 at 11:35:02AM -0500, Tom Lane wrote: > > 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. > > Agreed. Once per process seems best. I only hesitated before since it > means > nothing will free this storage, which could be annoying in the context of > Valgrind and similar. However, ECPG already has bits of never-freed > memory in > the form of pthread_key_create() calls having no pthread_key_delete(), so I > don't mind adding a bit more. > Did this get anywhere? Is there something we could do to make this move forward? -- Guillaume.
Commits
-
Fix previous commit's ecpg_clocale for ppc Darwin.
- f5e4d64bb338 10.22 landed
- 1cad30e3ba82 11.17 landed
- a4240139fc76 12.12 landed
- 97b005f3fb1b 13.8 landed
- 8533eb181ae4 15.0 landed
- 463a841d7407 14.5 landed
- e2bc242833da 16.0 landed
-
ecpglib: call newlocale() once per process.
- d68b731a1504 11.17 landed
- 12b2a2369deb 10.22 landed
- b4d7e92bd535 13.8 landed
- 7a28f7cb09bf 15.0 landed
- 5e0b8f3f4f87 12.12 landed
- 5b94e2bd4d54 14.5 landed
- 5633836ef306 16.0 landed