I have a daemon that connects to multiple databases with predefined time
interval to retrieve information. The connections are opened and closed. I
have noticed that after a while the process takes over 500MB of space
eventually filling up the swap area. I was able to distill down the problem
to the following example:
#!/apps/perl/bin/perl
use DBI;
while ( 1 )
{
$dbh = DBI->connect("ORCL", "scott", "tiger", "Oracle" )
|| die $DBI::errstr;
$dbh->disconnect();
}
I was monitoring the process using the pmap and I've noticed that the heap
allocated memory kept growing at a rate of 35K per connection. Is this a
known issue? I could work around this by keeping persistent connections,
but I'd like to know whether this is a bug (memory leak).
Thanks.
# /usr/proc/bin/pmap -x 3418
3418: /apps/perl/bin/perl test.pl
Address Kbytes Resident Shared Private Permissions Mapped File
00010000 696 680 336 344 read/exec perl
000CC000 56 56 8 48 read/write/exec perl
000DA000 7568 6000 - 6000 read/write/exec [ heap ]
EEC00000 5920 3000 2936 64 read/exec libclntsh.so.8.0
EF1D6000 200 200 - 200 read/write/exec libclntsh.so.8.0
EF208000 72 32 - 32 read/write/exec [ anon ]
EF4D0000 88 80 80 - read/exec libm.so.1
EF4F4000 8 8 - 8 read/write/exec libm.so.1
EF500000 8 8 8 - read/exec libkstat.so.1
EF510000 8 8 - 8 read/write/exec libkstat.so.1
EF520000 24 24 24 - read/exec libposix4.so.1
EF534000 8 8 - 8 read/write/exec libposix4.so.1
EF540000 24 16 16 - read/exec libaio.so.1
EF554000 8 8 - 8 read/write/exec libaio.so.1
EF556000 8 - - - read/write/exec [ anon ]
EF560000 8 8 8 - read/exec libskgxp8.so
EF570000 8 8 - 8 read/write/exec libskgxp8.so
EF580000 136 136 48 88 read/exec Oracle.so
EF5B0000 16 16 - 16 read/write/exec Oracle.so
EF5C0000 64 64 48 16 read/exec DBI.so
EF5DE000 16 16 - 16 read/write/exec DBI.so
EF5F0000 8 8 - 8 read/write/exec [ anon ]
EF600000 592 552 536 16 read/exec libc.so.1
EF6A2000 32 32 - 32 read/write/exec libc.so.1
EF6AA000 8 8 - 8 read/write/exec [ anon ]
EF6C0000 16 16 16 - read/exec libc_psr.so.1
EF6D0000 16 16 16 - read/exec libmp.so.2
EF6E2000 8 8 - 8 read/write/exec libmp.so.2
EF700000 448 408 408 - read/exec libnsl.so.1
EF77E000 32 32 - 32 read/write/exec libnsl.so.1
EF786000 24 16 - 16 read/write/exec [ anon ]
EF790000 32 32 32 - read/exec libsocket.so.1
EF7A6000 8 8 - 8 read/write/exec libsocket.so.1
EF7A8000 8 - - - read/write/exec [ anon ]
EF7B0000 8 8 8 - read/exec/shared libdl.so.1
EF7C0000 112 112 112 - read/exec ld.so.1
EF7EA000 16 16 - 16 read/write/exec ld.so.1
EFFF6000 40 40 - 40 read/write/exec [ stack ]
-------- ------ ------ ------ ------
total Kb 16352 11688 4640 7048
installation:
# perl -v
This is perl, version 5.005_03 built for sun4-solaris
Solaris 2.6
Thu Jan 13 17:22:49 2000: Module the DBI manpage
o installed into: /apps/perl/lib/site_perl/5.005
o LINKTYPE: dynamic
o VERSION: 1.13
o EXE_FILES: dbish dbiproxy
Thu Jan 13 17:36:26 2000: Module the DBD::Oracle manpage
o installed into: /apps/perl/lib/site_perl/5.005
o LINKTYPE: dynamic
o VERSION: 1.03
o EXE_FILES: ora_explain