Re: Is there a memory leak in commit 8561e48?

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Is there a memory leak in commit 8561e48?
Дата
Msg-id 20180419061042.GC16000@paquier.xyz
обсуждение исходный текст
Ответ на Is there a memory leak in commit 8561e48?  ("jian.long@i-soft.com.cn" <jian.long@i-soft.com.cn>)
Ответы Re: Is there a memory leak in commit 8561e48?  (Michael Paquier <michael@paquier.xyz>)
Re: Is there a memory leak in commit 8561e48?  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Список pgsql-hackers
On Thu, Apr 19, 2018 at 11:38:09AM +0800, jian.long@i-soft.com.cn wrote:
> in commit 8561e48, _SPI_stack alloc from TopMemoryContext. But
> AtEOXact_SPI just set _SPI_stack = NULL. Is this a memory leak?

You are right.  I can easily see the leak if I use for example a
background worker which connects to a database, and launches many
transactions in a row.  The laziest reproducer I have is to patch one of
my bgworkers to launch millions of transactions in a tight loop and the
leak is plain (this counts relations automatically, does not matter):
https://github.com/michaelpq/pg_plugins/tree/master/count_relations

TopMemoryContext is associated to a session, so the comment in
AtEOXact_SPI() is wrong.
--
Michael

Вложения

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

Предыдущее
От: Kyotaro HORIGUCHI
Дата:
Сообщение: Re: Problem while updating a foreign table pointing to apartitioned table on foreign server
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: WIP: Covering + unique indexes.