Help needed for the resolution of memory leak

From: Sasmit Utkarsh <utkarshsasmit(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Help needed for the resolution of memory leak
Date: 2024-01-15 17:32:14
Message-ID: CAM-5MT0z3LEPHAYSMWEgVF4izPt0uCSti3PngsdGY8aUiX-JrA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

*===================================================================49697==ERROR:
LeakSanitizer: detected memory leaksDirect leak of 197920 byte(s) in 1237
object(s) allocated from: #0 0xf79e300b in __interceptor_malloc
(/nix/store/7z4l4r0kpgzvsi6zkjz52cvgb8ra06bd-gcc-12.2.0-lib/lib/libasan.so.8+0xbe00b)
#1 0xf78dd3f3 in PQmakeEmptyPGresult
(/nix/store/y03rfw0iycp00dxcf8vrmss4nj700fia-postgresql-14.9-lib/lib/libpq.so.5+0x113f3)Indirect
leak of 2525184 byte(s) in 1233 object(s) allocated from: #0 0xf79e300b
in __interceptor_malloc
(/nix/store/7z4l4r0kpgzvsi6zkjz52cvgb8ra06bd-gcc-12.2.0-lib/lib/libasan.so.8+0xbe00b)
#1 0xf78dd04c in pqResultAlloc
(/nix/store/y03rfw0iycp00dxcf8vrmss4nj700fia-postgresql-14.9-lib/lib/libpq.so.5+0x1104c)Indirect
leak of 632832 byte(s) in 1236 object(s) allocated from: #0 0xf79e300b
in __interceptor_malloc
(/nix/store/7z4l4r0kpgzvsi6zkjz52cvgb8ra06bd-gcc-12.2.0-lib/lib/libasan.so.8+0xbe00b)
#1 0xf78dc7e0 in pqAddTuple
(/nix/store/y03rfw0iycp00dxcf8vrmss4nj700fia-postgresql-14.9-lib/lib/libpq.so.5+0x107e0)SUMMARY:
AddressSanitizer: 3355936 byte(s) leaked in 3706 allocation(s).*

Regards,
Sasmit Utkarsh
+91-7674022625

Attachment Content-Type Size
LeakSanitizer report.txt text/plain 407.2 KB
fun_def_and_other_details.txt text/plain 7.2 KB

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2024-01-15 17:35:19 Re: Unable to find column
Previous Message arun chirappurath 2024-01-15 17:26:57 Re: Unable to find column