Subject: | Memory leak with AutoInactiveDestroy |
Date: | Fri, 09 May 2014 11:08:15 -0500 |
To: | bug-DBD-Pg [...] rt.cpan.org |
From: | Alex Solovey <a.solovey [...] gmail.com> |
Setting AutoInactiveDestroy => 1 on database handle causes serious
memory leaks. See attached script for a small example.
The support for AutoInactiveDestroy was introduced in 3.0.0 (see bug
#68893), but it prevents all statement handles from being destroyed in
parent process, instead of those remaining active in a child process
after a fork. I do not see any checks for pid change in
AutoInactiveDestroy code in DBD::Pg dbdimp.c, while relevant code in DBI
has it (DBI.xs):
if (DBIc_AIADESTROY(imp_xxh)) { /* wants ineffective destroy
after fork */
if ((U32)PerlProc_getpid() != _imp2com(imp_xxh, std.pid))
DBIc_set(imp_xxh, DBIcf_IADESTROY, 1);
}
Version info:
# perl -MDBD::Pg -E 'say DBD::Pg->VERSION'
3.1.1
# perl -MDBI -E 'say DBI->VERSION'
1.63
# uname -a
Linux localhost 3.13.10-200.fc20.x86_64 #1 SMP Mon Apr 14 20:34:16 UTC
2014 x86_64 x86_64 x86_64 GNU/Linux
# perl -v
This is perl 5, version 18, subversion 2 (v5.18.2) built for
x86_64-linux-thread-multi
Message body is not shown because sender requested not to inline it.