Re: SPI_cursor_fetch Memory overrun

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: SPI_cursor_fetch Memory overrun
Дата
Msg-id 8729.1534982927@sss.pgh.pa.us
обсуждение исходный текст
Ответ на SPI_cursor_fetch Memory overrun  (Wu Ivy <ivywuyzl@gmail.com>)
Список pgsql-hackers
Wu Ivy <ivywuyzl@gmail.com> writes:
>                      fprintf(fp, (i == tupdesc->natts) ? "%s\n" : "%s," , SPI_getvalue(tuple, tupdesc, i));

That (specifically the SPI_getvalue call) is what's leaking memory.
You could improve matters by pfree'ing the result string after each
such call.

Just to add insult to injury, it's also looking up the column datatype's
output function afresh on every call.  There could perhaps be some leakage
involved in those lookups too, though I'd bet the main problem is the
result strings.

            regards, tom lane


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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Query is over 2x slower with jit=on
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Windows vs C99 (was Re: C99 compliance for src/port/snprintf.c)