Subject: | Bug (leak?) with IO::Select object creation? |
Consider the following code:
use strict;
use IO::Socket::INET;
use IO::Select;
use Data::Dumper;
my $hash;
$hash->{'sock1'} = new IO::Socket::INET ( PeerAddr => 'perl.org', PeerPort => 80, Proto => 'tcp', LocalAddr => undef, LocalPort => undef ) or die "ERROR : connect failed\n";
$hash->{'sock2'} = new IO::Socket::INET ( PeerAddr => 'perl.org', PeerPort => 80, Proto => 'tcp', LocalAddr => undef, LocalPort => undef ) or die "ERROR : connect failed\n";
$hash->{'sock3'} = new IO::Socket::INET ( PeerAddr => 'perl.org', PeerPort => 80, Proto => 'tcp', LocalAddr => undef, LocalPort => undef ) or die "ERROR : connect failed\n";
$hash->{'sock1select'} = IO::Select->new ( $hash->{'sock1'} ) or die qq[ERROR: failed to create new select];
$hash->{'sock2select'} = IO::Select->new ( $hash->{'sock2'} ) or die qq[ERROR: failed to create new select];
$hash->{'sock3select'} = IO::Select->new ( $hash->{'sock3'} ) or die qq[ERROR: failed to create new select];
print Dumper ( $hash );
It produces the following output:
# perl ioselectbug.pl
$VAR1 = {
'sock1select' => bless( [
'',
1,
undef,
undef,
undef,
undef,
bless( \*Symbol::GEN0, 'IO::Socket::INET' )
], 'IO::Select' ),
'sock2' => bless( \*Symbol::GEN1, 'IO::Socket::INET' ),
'sock3select' => bless( [
'@',
1,
undef,
undef,
undef,
undef,
undef,
undef,
bless( \*Symbol::GEN2, 'IO::Socket::INET' )
], 'IO::Select' ),
'sock2select' => bless( [
' ',
1,
undef,
undef,
undef,
undef,
undef,
$VAR1->{'sock2'}
], 'IO::Select' ),
'sock1' => $VAR1->{'sock1select'}[6],
'sock3' => $VAR1->{'sock3select'}[8]
};
We create three IO::Select objects in the same way but each object is slightly bigger than the last. Surely each object should be the same size?
The same behavior occurs on either Win32 or Solaris.