pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #15627: libpq memory leak
3+ messages / 3 participants
[nested] [flat]
* BUG #15627: libpq memory leak
@ 2019-02-10 16:30 PG Bug reporting form <noreply@postgresql.org>
0 siblings, 1 reply; 3+ messages in thread
From: PG Bug reporting form @ 2019-02-10 16:30 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: icegood1980@gmail.com
The following bug has been logged on the website:
Bug reference: 15627
Logged by: ice ice
Email address: icegood1980@gmail.com
PostgreSQL version: 11.1
Operating system: Ubuntu 18.04.1 LTS
Description:
PQisBusy has memory leak with next valgrind stack:
1: malloc in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so
2: PQmakeEmptyPGresult in
/opt/src/postgres/src/interfaces/libpq/fe-exec.c:146
3: getRowDescriptions in
/opt/src/postgres/src/interfaces/libpq/fe-protocol3.c:492
4: pqParseInput3 in
/opt/src/postgres/src/interfaces/libpq/fe-protocol3.c:293
5: parseInput in /opt/src/postgres/src/interfaces/libpq/fe-exec.c:1747
6: PQisBusy in /opt/src/postgres/src/interfaces/libpq/fe-exec.c:1764
The problem is that if PQisBusy doesn't revoke memory for item
/* Status for asynchronous result construction */
PGresult *result; /* result being constructed */
in struct pg_conn
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #15627: libpq memory leak
@ 2019-02-10 17:03 Tom Lane <tgl@sss.pgh.pa.us>
parent: PG Bug reporting form <noreply@postgresql.org>
0 siblings, 1 reply; 3+ messages in thread
From: Tom Lane @ 2019-02-10 17:03 UTC (permalink / raw)
To: icegood1980@gmail.com; +Cc: pgsql-bugs@lists.postgresql.org
PG Bug reporting form <noreply@postgresql.org> writes:
> PQisBusy has memory leak with next valgrind stack:
> 1: malloc in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so
> 2: PQmakeEmptyPGresult in
> /opt/src/postgres/src/interfaces/libpq/fe-exec.c:146
> 3: getRowDescriptions in
> /opt/src/postgres/src/interfaces/libpq/fe-protocol3.c:492
> 4: pqParseInput3 in
> /opt/src/postgres/src/interfaces/libpq/fe-protocol3.c:293
> 5: parseInput in /opt/src/postgres/src/interfaces/libpq/fe-exec.c:1747
> 6: PQisBusy in /opt/src/postgres/src/interfaces/libpq/fe-exec.c:1764
I don't believe this is actually a leak: what is happening is that
we're collecting the query result that will eventually be returned
by PQgetResult. If the calling program never calls PQgetResult
after PQisBusy, then tools like valgrind might claim that's a leak,
but the claim has nothing to do with reality.
If you think there's a real problem here, please show a self-contained
test case that causes steady increase in memory consumption.
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #15627: libpq memory leak
@ 2019-02-10 21:20 Sergey Ivanov <icegood1980@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 3+ messages in thread
From: Sergey Ivanov @ 2019-02-10 21:20 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs@lists.postgresql.org
Thanks Tom. My fault. Hasn't closed PGRES_TUPLES_OK last empty record in
single row mode output
вс, 10 февр. 2019 г. в 19:03, Tom Lane <tgl@sss.pgh.pa.us>:
> PG Bug reporting form <noreply@postgresql.org> writes:
> > PQisBusy has memory leak with next valgrind stack:
>
> > 1: malloc in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so
> > 2: PQmakeEmptyPGresult in
> > /opt/src/postgres/src/interfaces/libpq/fe-exec.c:146
> > 3: getRowDescriptions in
> > /opt/src/postgres/src/interfaces/libpq/fe-protocol3.c:492
> > 4: pqParseInput3 in
> > /opt/src/postgres/src/interfaces/libpq/fe-protocol3.c:293
> > 5: parseInput in /opt/src/postgres/src/interfaces/libpq/fe-exec.c:1747
> > 6: PQisBusy in /opt/src/postgres/src/interfaces/libpq/fe-exec.c:1764
>
> I don't believe this is actually a leak: what is happening is that
> we're collecting the query result that will eventually be returned
> by PQgetResult. If the calling program never calls PQgetResult
> after PQisBusy, then tools like valgrind might claim that's a leak,
> but the claim has nothing to do with reality.
>
> If you think there's a real problem here, please show a self-contained
> test case that causes steady increase in memory consumption.
>
> regards, tom lane
>
--
Kind regards,
Sergey Ivanov
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2019-02-10 21:20 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-02-10 16:30 BUG #15627: libpq memory leak PG Bug reporting form <noreply@postgresql.org>
2019-02-10 17:03 ` Tom Lane <tgl@sss.pgh.pa.us>
2019-02-10 21:20 ` Sergey Ivanov <icegood1980@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox