Help needed for the resolution of memory leak - Mailing list pgsql-general

From Sasmit Utkarsh
Subject Help needed for the resolution of memory leak
Date
Msg-id CAM-5MT0z3LEPHAYSMWEgVF4izPt0uCSti3PngsdGY8aUiX-JrA@mail.gmail.com
Whole thread Raw
Responses Re: Help needed for the resolution of memory leak
List 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 leaks

Direct 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

pgsql-general by date:

Previous
From: arun chirappurath
Date:
Subject: Re: Unable to find column
Next
From: Adrian Klaver
Date:
Subject: Re: Unable to find column