SlabCheck leaks memory into TopMemoryContext

Поиск
Список
Период
Сортировка
От Andres Freund
Тема SlabCheck leaks memory into TopMemoryContext
Дата
Msg-id 20200116044119.g45f7pmgz4jmodxj@alap3.anarazel.de
обсуждение исходный текст
Ответы Re: SlabCheck leaks memory into TopMemoryContext
Список pgsql-hackers
Hi Tomas,

I just noticed that having a slab context around in an assertion build
leads to performance degrading and memory usage going up. A bit of
poking revealed that SlabCheck() doesn't free the freechunks it
allocates.

It's on its own obviously trivial to fix.

But there's also this note at the top:
 * NOTE: report errors as WARNING, *not* ERROR or FATAL.  Otherwise you'll
 * find yourself in an infinite loop when trouble occurs, because this
 * routine will be entered again when elog cleanup tries to release memory!

which seems to be violated by doing:

    /* bitmap of free chunks on a block */
    freechunks = palloc(slab->chunksPerBlock * sizeof(bool));

I guess it'd be better to fall back to malloc() here, and handle the
allocation failure gracefully? Or perhaps we can just allocate something
persistently during SlabCreate()?

Greetings,

Andres Freund



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

Предыдущее
От: Mahendra Singh Thalor
Дата:
Сообщение: Re: [HACKERS] Block level parallel vacuum
Следующее
От: Amit Khandekar
Дата:
Сообщение: Re: Minimal logical decoding on standbys