Subject: | Memory leak in first() |
Distribution name and version: Scalar-List-Utils-1.17
Perl version: v5.8.7
OS: FreeBSD 5.4-RELEASE-p4 i386
Distribution name and version: Scalar-List-Utils-1.13
Perl version: v5.8.4
OS: Linux Knoppix 2.6.11 i686
Code:
------------------------------------------------------------
#!/usr/bin/perl
use warnings;
use strict;
use Devel::Peek;
use List::Util qw(first);
my @list = (1, 2, 3, 4, 5);
my $value = 1;
print "BEFORE:\n---------------\n";
Dump($value);
my $foo = first { $_ > $value } @list;
print "AFTER:\n---------------\n";
Dump($value);
------------------------------------------------------------
Output:
------------------------------------------------------------
BEFORE:
---------------
SV = IV(0x8076880) at 0x8057bf8
REFCNT = 1
FLAGS = (PADBUSY,PADMY,IOK,pIOK)
IV = 1
AFTER:
---------------
SV = IV(0x8076880) at 0x8057bf8
REFCNT = 2
FLAGS = (PADBUSY,PADMY,IOK,pIOK)
IV = 1
------------------------------------------------------------
REFCNT changed from 1 to 2. It's a bug, I mean.