Re: Help needed for the resolution of memory leak

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: Help needed for the resolution of memory leak
Дата
Msg-id CAHyXU0wmjF=3qmR5NZtpZMTKM958Nhsb022Yz0TGHFMO5VH=9w@mail.gmail.com
обсуждение исходный текст
Ответ на Help needed for the resolution of memory leak  (Sasmit Utkarsh <utkarshsasmit@gmail.com>)
Список pgsql-general
On Mon, Jan 15, 2024 at 11:32 AM Sasmit Utkarsh <utkarshsasmit@gmail.com> wrote:
Hi Team,

I am trying to test a code which basically tries to read some data from postgresql db in a loop through a function SQL_get_tpf_rw() whose definition and other details are shared in the attached file along with the memory leak report resulted during testing. Could you let me know if i missed calling  anywhere PQclear()
in SQL_get_tpf_rw() which resulted in the below .

Last few lines from the report


yep:  for example,

      if (PQresultStatus(res) != PGRES_TUPLES_OK)           {                LOG_ERROR("SELECT failed: %s", PQerrorMessage(conn));		LOG_DEBUG("ROLLBACK TRANSACTION AND CHAIN");		res = PQexec(conn,"ROLLBACK TRANSACTION AND CHAIN");		LOG_ERROR("INVALID_FILE_ADDRESS %08X",fa);		rc = ERR_INVALID_FILE_ADDRESS;

See highlighted bits.  You're reusing the res object before clearing it.  there may be other cases, but this jumped off the page.

merlin

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

Предыдущее
От: Justin Clift
Дата:
Сообщение: Re: Moving to Postgresql database
Следующее
От: Lan Xu
Дата:
Сообщение: Re: Help with "Create Extension unaccent"