<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 10 (filtered)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.emailstyle17
        {font-family:Arial;
        color:windowtext;}
span.emailstyle18
        {font-family:Arial;
        color:navy;}
span.EmailStyle19
        {font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Found it. There’s good news
and there’s bad news. The good news: most people won’t be
affected by the leak. The bad news: it’s not just me.</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>The problem is in DBI.pm, specifically in
the sth method:</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:navy'>sub sth {</span></font></p>
<p class=MsoNormal><font size=2 color=navy face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:navy'> my ($self,
$sql) = @_;</span></font></p>
<p class=MsoNormal><font size=2 color=navy face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:navy'> # 3 is the
if_active parameter which avoids active sth re-use</span></font></p>
<p class=MsoNormal><font size=2 color=navy face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:navy'> return
$self->dbh->prepare_cached($sql, {}, 3);</span></font></p>
<p class=MsoNormal><font size=2 color=navy face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:navy'>}</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>The prepare_cached call means that the
statement handle is saved in $self->dbh for that particular sql
statement. If the statement is used again the existing statement handle
is returned from the cache. Using the cache is where the leak occurs.
It isn’t cleared until dbh is destroyed.</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>So why was I affected and most people
won’t be? I’m using the FreeTDS library for low level access
to the database. That library doesn’t support bind variables, so I
subclassed DBI.pm to override the _execute method so I could build sql
statements without bind variables.</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>That’s all well and good, but it
meant that the $sql passed to sth was always different. There were no
hits in the cache so a new statement handle was created for each
statement. The solution: override sth and use dbh->prepare instead of
dbh->prepare_cached:</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:navy'>sub sth {</span></font></p>
<p class=MsoNormal><font size=2 color=navy face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:navy'> my ($self,
$sql) = @_;</span></font></p>
<p class=MsoNormal><font size=2 color=navy face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:navy'> return
$self->dbh->prepare( $sql, {} );</span></font></p>
<p class=MsoNormal><font size=2 color=navy face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:navy'>}</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Bottom line: there is a leak but as long
as your driver supports bind variables you are not likely to be affected.</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>- Alan</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'>-----Original Message-----<br>
<b><span style='font-weight:bold'>From:</span></b>
dbix-class-bounces@lists.rawmode.org
[mailto:dbix-class-bounces@lists.rawmode.org] <b><span style='font-weight:bold'>On
Behalf Of </span></b>Alan Humphrey<br>
<b><span style='font-weight:bold'>Sent:</span></b> </span></font><font size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>Wednesday,
March 15, 2006</span></font><font size=2 face=Tahoma><span style='font-size:
10.0pt;font-family:Tahoma'> </span></font><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'>9:40 AM</span></font><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'><br>
<b><span style='font-weight:bold'>To:</span></b> dbix-class@lists.rawmode.org<br>
<b><span style='font-weight:bold'>Subject:</span></b> [Dbix-class] memory leak</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'> </span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>I’ve found a memory leak in
DBIx::Class that I’m not really sure how to track down further.
I’m hoping someone with more familiarity with the internals can give me a
pointer as to where to look. Here are the particulars:</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'> </span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>OS: NetBSD 3.0</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>DBIx: 0.05007</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'> </span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>Sample program:</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'> </span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>#!/usr/pkg/bin/perl -w</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>use lib
"/home/alanh/birdweb/trunk/BirdWeb-Admin/lib";</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>use BirdWeb::Admin;</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>my $staging =
"BirdWeb::Admin::Model::Production";</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>#my $staging =
"BirdWeb::Admin::Model::Staging";</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> </span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>my $res =
$staging->resultset('Birds')->search({id => { '>' => 450} } );</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>my $counter =1;</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>my $count =
$res->count();</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>while ( my $row =
$res->next ) {</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>
print "\t$count\t".$counter++. "\n";</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>
print $row->default_bird_common_name_id->bird_common_name .
"\n";</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>}</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>warn "end of
program\n";</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'> </span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'> </span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>With the DBI TraceLevel set to 1
here’s the relevant part of the stderr output:</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'> </span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'> </span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> <-
FETCH('Driver')= DBI::dr=HASH(0x8fb1294) at Limit.pm line 301</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> <-
FETCH('Driver')= DBI::dr=HASH(0x8fb1294) at Limit.pm line 338</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> <-
FETCH('Active')= 1 at DBI.pm line 276</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> <-
ping= 1 at DBI.pm line 276</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> <-
prepare_cached('SELECT me.id, me.bird_id, me.bird_common_name,
me.common_name_notes FROM bird_common_names me WHERE ( ( ( me.id = ? ) ) )'
HASH(0x91824c0) ...)= DBI::st=HASH(0x96e8af8) at DBI.pm line 448</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> <-
execute('450')= 1 at DBI.pm line 386</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> <-
fetchrow_array= ( '450' '484' 'Painted Bunting' undef ) [4 items] row1 at
Cursor.pm line 36</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> <-
FETCH('Active')= 1 at Cursor.pm line 66</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> <-
finish= 1 at Cursor.pm line 66</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>end of program</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::st=HASH(96e8af8))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::st=HASH(95cefd8))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::st=HASH(964d774))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::db=HASH(9679f54))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'> </span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'> </span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>Notice that the statement handles
aren’t destroyed until after the end of the program. The first one
in the list should have been destroyed at the bottom of the while loop (before
“end of program” was output).</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'> </span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>Why does this matter? It
depends on the DBI driver you’re using. In the example above the
MySQL driver is used and it reuses the statement handle. The same program
executed against a MSSQL database using the Sybase driver has stderr output that
looks like this:</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'> </span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> <-
FETCH('Driver')= DBI::dr=HASH(0x8fb1294) at Limit.pm line 301</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> <-
FETCH('Driver')= DBI::dr=HASH(0x8fb1294) at Limit.pm line 338</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> <-
FETCH('Active')= 1 at DBI.pm line 276</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> <-
ping= 1 at DBI.pm line 276</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> <- quote(450)=
''450'' at NoBindStorage.pm line 18</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> <-
FETCH('Active')= 1 at DBI.pm line 276</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> <-
ping= 1 at DBI.pm line 276</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> <-
prepare_cached('SELECT me.id, me.bird_id, me.bird_common_name,
me.common_name_notes FROM bird_common_names me WHERE ( ( ( me.id = '450' ) ) )'
HASH(0x9768cfc) ...)= DBI::st=HASH(0x98738c4) at DBI.pm line </span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>448</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> <-
execute= -1 at NoBindStorage.pm line 31</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> <-
fetchrow_array= ( 450 484 'Painted Bunting' undef ) [4 items] row1 at Cursor.pm
line 36</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> <-
FETCH('Active')= 1 at Cursor.pm line 66</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> <-
finish= 1 at Cursor.pm line 66</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>end of program</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::st=HASH(9873534))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::st=HASH(98730c0))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::st=HASH(9873618))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::st=HASH(98731a4))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::st=HASH(98736fc))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::st=HASH(9873288))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <- DESTROY(DBI::st=HASH(98737e0))=
undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::st=HASH(987336c))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::st=HASH(98738c4))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::st=HASH(9873450))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::st=HASH(9768510))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::st=HASH(976809c))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::st=HASH(97685f4))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <- DESTROY(DBI::st=HASH(9768180))=
undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::st=HASH(97686d8))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::st=HASH(9768264))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::st=HASH(97687bc))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::st=HASH(9768348))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::st=HASH(97688a0))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::st=HASH(976842c))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::st=HASH(9768984))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::st=HASH(9768a68))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::st=HASH(9768b4c))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::st=HASH(9768c30))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::st=HASH(9768d14))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::st=HASH(9768df8))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::st=HASH(9768edc))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::st=HASH(9768fc0))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::st=HASH(9743f9c))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::st=HASH(9750678))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::st=HASH(9683d2c))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <- DESTROY(DBI::st=HASH(963ee40))=
undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>! <-
DESTROY(DBI::db=HASH(967fe1c))= undef during global destruction</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'> </span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'> </span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>As you can see, that driver
doesn’t reuse the statement handle and memory is leaked.</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'> </span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>I looked at the Cursor.pm code and
it looks like pains are taken to try and delete the statement handle, but
clearly something is maintaining a reference to it.</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'> </span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>Anybody have any ideas? This
leak makes it impossible to use DBIx::Class for batch operations against my
production database.</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'> </span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>Thank you!</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'> </span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>- Alan</span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'> </span></font></p>
</div>
</body>
</html>