On Fri, Mar 30, 2001 at 10:02:14AM -0500, Ondercin, Boris wrote:
> Is the workaround setting $dbh->{RaiseError}=0 ?

Don't use local() on handle attribute. Reset the attribute value
explicitly at the end of the block and in any exception handlers that
may catch exceptions thrown from within the block (which would
thereforce miss your explicit resetting of the attribue).

Tim.

> -----Original Message-----
> From: Tim Bunce [mailto:[EMAIL PROTECTED]]
> Sent: Friday, March 30, 2001 9:40 AM
> To: [EMAIL PROTECTED]
> Subject: Memory leak on local($dbh->{RaiseError})=1 is a perl bug
> 
> 
> Here's a copy of a bug report I just sent to perl5-porters.
> 
> FTI, DBI 1.15 will be released shortly :)
> 
> Tim.
> 
> ----- Forwarded message from Tim Bunce <[EMAIL PROTECTED]> -----
> 
> Date: Fri, 30 Mar 2001 15:38:27 +0100
> From: Tim Bunce <[EMAIL PROTECTED]>
> To: Perl 5 porters <[EMAIL PROTECTED]>
> Cc: Tim Bunce <[EMAIL PROTECTED]>
> Subject: Memory leak localizing a tied variable
> 
> The script appended below demonstrates a memory leak when doing a
> local() on a tied variable.
> 
> I found this because someone reported that local($dbh->{RaiseError})=1
> (and similar) leaked memory and thought it maybe a DBI bug.
> The script demonstrates that it's not.
> 
> Perl 5.005 and 5.006 leak but 5.004 doesn't. I've not got a 5.7.0
> handy. I'd be grateful if someone could test it on the current bleadperl.
> 
> Thanks.
> 
> Tim.
> 
> #!/usr/local/bin/perl -w
> 
> print "localizing tied variable leak test for perl $]...\n";
> # 5.006   does leak
> # 5.00503 does leak
> # 5.00404 doesn't leak
> 
> use strict;
> use Tie::Hash;
> tie my %tie_hash => 'Tie::StdHash';
> 
> my $count = 0;
> my $ps = (-d '/proc') ? "ps -lp " : "ps -l";
> 
> mem_test() while 1;
> 
> sub mem_test {
>     system("echo $count; $ps$$") if (($count++ % 1000) == 0);
>     local($tie_hash{Foo}) = 1;
> }
> 
> ----- End forwarded message -----

Reply via email to