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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Is there a memory leak in commit 8561e48?
Дата
Msg-id 28487.1525278629@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Is there a memory leak in commit 8561e48?  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Ответы Re: Is there a memory leak in commit 8561e48?  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Список pgsql-hackers
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> On 5/1/18 11:42, Tom Lane wrote:
>> Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
>> That seems like an odd way to approach this.  Why not just remove the
>> reset of _SPI_stack and _SPI_stack_depth, so as to subtract code rather
>> than adding it --- that is, make it actually work like you mistakenly
>> thought it did?  If we're going to keep the stack in TopMemoryContext,
>> there's no need to thrash it on every transaction.

> Yes, that seems attractive.

> Are we concerned about the case where someone runs a very deeply nested
> SPI setup once in a session, creating a large stack allocation, which
> then persists for the rest of the session?

I'm not particularly.  It seems impossible that _SPI_stack could grow
faster than the machine's actual stack, which would mean (on typical
setups) that you couldn't get more than perhaps 10MB of _SPI_stack
before hitting a stack-overflow error.  That's a lot by some measures,
but I don't think it's enough to cripple anything if we don't free it.

Also, if someone is routinely using pretty deep SPI nesting, they'd
probably be happier that we do keep the stack rather than repeatedly
creating and enlarging it.

            regards, tom lane


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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: [HACKERS] Clock with Adaptive Replacement
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Sort performance cliff with small work_mem