develooper Front page | perl.perl5.porters | Postings from August 2008

Re: [perl #56908] DBI memory leak

Thread Previous | Thread Next
From:
Bram
Date:
August 5, 2008 13:00
Subject:
Re: [perl #56908] DBI memory leak
Message ID:
20080805220012.qknkwg6uoo0g8wo0@horde.wizbit.be
Citeren "lav@yar.ru (via RT)" <perlbug-followup@perl.org>:

> # New Ticket Created by  lav@yar.ru
> # Please include the string:  [perl #56908]
> # in the subject line of all future correspondence about this issue.
> # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=56908 >
>
>
> This is a bug report for perl from lav@yar.ru,
> generated with the help of perlbug 1.36 running under perl 5.10.0.
>
>
> -----------------------------------------------------------------
> [Please enter your report here]
> Under perl-5.10.0 the following simple program leaks memory,
> while under perl-5.8.8 it does not. DBI module version is the
> same under both perl versions (1.605). The leak seems to be not
> specific to DBD driver, as it also happens with mysql and
> oracle drivers.
>
> use DBI;
> my $dbh=DBI->connect('DBI:NullP:');
> while(1) {
> 	my $q=$dbh->prepare(q{select 1 from dual});
> }
>

I've done a binary search on it with these results: (with DBI-1.607)

----Program----
#!/usr/bin/perl -l

use DBI;

my $dbh=DBI->connect('DBI:NullP:');
my $i = 0;
my $mem1 = qx/ps u $$/;

while ($i++ < 100_000) {
   my $q=$dbh->prepare(q{select 1 from dual});
}

my $mem2 = qx/ps u $$/;

my ($vsz1) = $mem1 =~ m/^perl\s+\d+\s+[0-9.]+\s+[0-9.]+\s+(\d+)/m;
my ($vsz2) = $mem2 =~ m/^perl\s+\d+\s+[0-9.]+\s+[0-9.]+\s+(\d+)/m;
if ($vsz1 + 1000 < $vsz2) {
   print "not ok";
}
else {
   print "ok";
}


----Output of .../pUmCekJ/perl-5.9.2@26529/bin/perl----
ok

----EOF ($?='0')----
----Output of .../pn6SMVj/perl-5.9.2@26530/bin/perl----
not ok

----EOF ($?='0')----

The output with blead is the same. (meaning: it hasn't changed since)

http://public.activestate.com/cgi-bin/perlbrowse/p/26530
Change 26530 by nicholas@nicholas-saigo on 2005/12/30 01:08:46

	RMAGIC on symbol tables is bad, m'kay.
	Allow hashes (and therefore all symbol tables) to store the
	backreference array in the hv_aux structure, and thereby undo the
	performance damage of 24966, which resulted in 60% of all hash lookups
	trying to mg_find tiehash magic.


I'll leave it up to someone else to figure out if it's a bug in the  
CORE or a bug in DBI...


Kind regards,

Bram



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About