Re: Probable memory leak with ECPG and AIX

Поиск
Список
Период
Сортировка
От Noah Misch
Тема Re: Probable memory leak with ECPG and AIX
Дата
Msg-id 20220101074055.GA54621@rfd.leadboat.com
обсуждение исходный текст
Ответ на Re: Probable memory leak with ECPG and AIX  (Benoit Lobréau <benoit.lobreau@gmail.com>)
Ответы Re: Probable memory leak with ECPG and AIX  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Wed, Dec 15, 2021 at 04:20:42PM +0100, Benoit Lobréau wrote:
> * with LDR_CNTRL=MAXDATA=0x10000000, we reach 256Mo but there is no
> segfault, the program just continues running ;
> * with LDR_CNTRL=MAXDATA=0x80000000, we reach 2Go and there is no segfault
> either, the program just continues running.

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:

#include <locale.h>
int main(int argc, char **argv)
{
    while (1)
        freelocale(newlocale(LC_NUMERIC_MASK, "C", (locale_t) 0));
    return 0;
}

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().



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Zhihong Yu
Дата:
Сообщение: Re: Speed up transaction completion faster after many relations are accessed in a transaction
Следующее
От: "Joel Jacobson"
Дата:
Сообщение: Re: Foreign key joins revisited