Memory leak

From: "Spencer Quin" <squin(at)rim(dot)com>
To: <pgsql-bugs(at)postgresql(dot)org>
Cc: "Thomas Parry" <TParry(at)rim(dot)com>, "Geoffrey Stitt" <gstitt(at)rim(dot)com>
Subject: Memory leak
Date: 2004-08-23 17:15:15
Message-ID: 7F0B5938B08C9345BA58ED090AA813F402BCE9AA@XCL02YKF.rim.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)rim(dot)com <mailto:*squin(at)rim(dot)com>

Attachment Content-Type Size
test3.c application/octet-stream 1.0 KB

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bellan Saravanan 2004-08-24 04:29:07 Postgres 8.0/Windows 2000 Load testing
Previous Message Guenter Abraham 2004-08-23 14:12:15 ecpg / libecpg.dll