Subject: | result leak in pg_db_putcopyend |
Date: | Fri, 30 Oct 2015 22:26:59 +0000 |
To: | "bug-DBD-Pg [...] rt.cpan.org" <bug-DBD-Pg [...] rt.cpan.org> |
From: | Mike Magin <mmagin [...] arubanetworks.com> |
While tracking down a memory leak in long-running Perl daemons in our software, I noticed that repeatedly using a COPY statement and ->pg_putcopyend to insert data would steadily leak memory. Valgrind was especially helpful and pointed me to the PGgetResult calls in dbdimpl.c
There seems to be a couple of loops where we retry PGgetResult until the result is NULL, but in doing so, we clobber the old value of the pointer and leak a result. The PG docs seem pretty insistent that all values returned by PGgetResult need to be eventually given to Pgclear or there will be leaks.
Anyway, the attached patch solved my problem
Thanks,
Mike
Message body is not shown because sender requested not to inline it.