Memory leak - Mailing list pgsql-bugs

From Spencer Quin
Subject Memory leak
Date
Msg-id 7F0B5938B08C9345BA58ED090AA813F402BCE9AA@XCL02YKF.rim.net
Whole thread Raw
Responses Re: Memory leak  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs

I have found a memory leak in the libpq library for postrgesql 7.4.3.  The code sample in the attached file will produce the error.

I used Valgrind(http://valgrind.kde.org/) which is an open source memory profiler application in order to find the problem.

 

Machine: Pentium 4

OS: Linux Fedora Core1

 

According to Valgrind if an application attempts to make 2 or more connections to the database then memory will be lost for every connection except the first.

 

Here is the error that I see from Valgrind for 2 separate connections:

==8980== 56 bytes in 2 blocks are definitely lost in loss record 1 of 1

==8980==    at 0x38E68E: malloc (vg_replace_malloc.c:153)

==8980==    by 0x13DE9B: __libc_res_nsend (in /lib/libresolv-2.3.2.so)

==8980==    by 0x13CC12: __libc_res_nquery (in /lib/libresolv-2.3.2.so)

==8980==    by 0x13D309: __libc_res_nquerydomain (in /lib/libresolv-2.3.2.so)

==8980==    by 0x13CF0F: __libc_res_nsearch (in /lib/libresolv-2.3.2.so)

==8980==    by 0x37705D: ???

==8980==    by 0x62AD25: gaih_inet (in /lib/libc-2.3.2.so)

==8980==    by 0x62B923: __GI_getaddrinfo (in /lib/libc-2.3.2.so)

==8980==    by 0xDF3661: getaddrinfo_all (in /usr/lib/libpq.so.3.1)

==8980==    by 0xDE4EBB: (within /usr/lib/libpq.so.3.1)

==8980==    by 0xDE4469: PQconnectStart (in /usr/lib/libpq.so.3.1)

==8980==    by 0xDE43F1: PQconnectdb (in /usr/lib/libpq.so.3.1)

==8980==    by 0x8048684: main (in /home/squin/yo)

==8980==    by 0x579BBE: __libc_start_main (in /lib/libc-2.3.2.so)

==8980==    by 0x804854C: (within /home/squin/yo)  

 

Any help on this issue is greatly appreciated.

            Thanks

 

Spencer Quin

Web Software Developer

Reseach In Motion

' (519) 888-7465 x2596

* squin@rim.com

 

Attachment

pgsql-bugs by date:

Previous
From: Guenter Abraham
Date:
Subject: ecpg / libecpg.dll
Next
From: Alvaro Herrera
Date:
Subject: Re: BUG #1228: numeric field from a view from a view does not recognise any where values