Re: Report a potential memory leak in setup_config()

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Report a potential memory leak in setup_config()
Дата
Msg-id 3239746.1644975946@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Report a potential memory leak in setup_config()  (Andres Freund <andres@anarazel.de>)
Ответы Re: Report a potential memory leak in setup_config()  (Andres Freund <andres@anarazel.de>)
Список pgsql-bugs
Andres Freund <andres@anarazel.de> writes:
> On 2022-02-15 11:33:26 -0500, Tom Lane wrote:
>> It might be worth trying to knock that down a bit, but I wouldn't
>> start with a one-time leak of 28 bytes.  It looks like the biggest
>> offender is that we don't bother trying to reclaim the lines
>> malloc'd by readfile() and replace_token().  Fixing that is *maybe*
>> worth the trouble, but TBH no one has complained about initdb's
>> memory consumption.

> It's a bit insane that we allocate the lines[] quite so many times, when
> processing the same file.

Yeah, I noticed that --- why don't we reuse the array of pointers?
Not sure it'd save much compared to freeing the strings, but it is
mighty low-hanging fruit.

> The replacement patterns either are
> compile time constants which we just should handle in genbki.pl, or have
> exactly 1 replacement....

Mmm, really?  I thought most of them were data that we don't know
until initdb runs.  Anything that really is known at build time,
sure, genbki.pl ought to take care of.

            regards, tom lane



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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Report a potential memory leak in setup_config()
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Report a potential memory leak in setup_config()