Re: Memory leak in formatting.c

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Memory leak in formatting.c
Дата
Msg-id 20190903033310.GC3765@paquier.xyz
обсуждение исходный текст
Ответ на Memory leak in formatting.c  (Konstantin Knizhnik <k.knizhnik@postgrespro.ru>)
Список pgsql-bugs
On Mon, Sep 02, 2019 at 07:52:30PM +0300, Konstantin Knizhnik wrote:
> Memory leak in formatting.c in case of using ICU.
> Proposed trivial fix is attached.

Right.  Those three code paths can be triggered with an ICU
collation.  I can see for example that patterns like the following one
consume more memory unpatched:
create collation german_phonebook
  (provider = icu, locale = 'de-u-co-phonebk');
create table german_phones (number text collate german_phonebook);
insert into german_phones
  select repeat('AB', 1000) || repeat('CD', 1000)
  from generate_series(1,1000000);
select count(lower(number))
  from german_phones, generate_series(1,10000000);

valgrind does not complain in this scenario.  Anyway, we cannot assume
that the callers of str_tolower & co are able to do a correct cleanup
of the memory context where the allocation happened, so I have applied
your patch and back-patched down to 10 where the issue has been
introduced.  Thanks, Konstantin!
--
Michael

Вложения

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

Предыдущее
От: Konstantin Knizhnik
Дата:
Сообщение: Memory leak in formatting.c
Следующее
От: Stephen Frost
Дата:
Сообщение: Re: BUG #15989: Cluster unable to open as hot standby after SIGKILLduring exclusive backup