Subject: | IPC::Run::run: memory leak when scalarref input parameter provided |
On Perl 5.6.1, IPC::Run appears to leak memory when a '<'
parameter is provided to the 'run' function. Each invocation appears to
result in about 2KB being lost.
This only happens if the stdin parameter is a scalar reference (including \undef) - using a filehandle glob like \*STDIN, or providing a filename like '/tmp/abc' does not have the same effect.
I've tested this on versions 0.77 and 0.79.
I'm running Redhat FC3 (uname -a output: Linux nick 2.6.11-1.35_FC3 #1 Mon Jun 13 00:52:08 EDT 2005 i686 i686 i386 GNU/Linux), but this bug has also been reproduced on ES3.0 as well as various other modern Redhat systems.
#!/usr/bin/perl
use strict;
use warnings;
use IPC::Run qw( run );
print "IPC::Run ($INC{'IPC/Run.pm'}) version: ", IPC::Run->VERSION, "\n";
while( 1 )
{
my ( $in, $out );
print '.';
run [ qw( cat - ) ],
'<', \$in,
'>', \$out
or die "can't run cat";
}