in reply to Re: Perl eats all memory when accessing hash/array refs wrong
in thread Perl eats all memory when accessing hash/array refs wrong

The problem is that you are using a reference as index in an array.

How so? You can certainly see the effect with the attempt to access the first non existent key (but only on Linux) but could you explain that further.....

C:\>type test.pl use Data::Dumper; my $a={ child1 => [ {child2 => [ { child3 => [ {child4 => [ 1 ] } ] } +] } ] }; print Dumper $a; print Dumper $a->{child1}; print Dumper $a->{child1}{child2}; print Dumper $a->{child1}{child2}{child3}; print Dumper $a->{child1}{child2}{child3}{child4}; C:\>perl test.pl $VAR1 = { 'child1' => [ { 'child2' => [ { 'child3' => [ { 'child4' => +[ + 1 +] } ] } ] } ] }; $VAR1 = [ { 'child2' => [ { 'child3' => [ { 'child4' => [ 1 ] } ] } ] } ]; $VAR1 = undef; $VAR1 = undef; $VAR1 = undef; C:\> [root@devel3 root]# cat test.pl use Data::Dumper; my $a={ child1 => [ {child2 => [ { child3 => [ {child4 => [ 1 ] } ] } +] } ] }; print Dumper $a; print Dumper $a->{child1}; print Dumper $a->{child1}{child2}; print Dumper $a->{child1}{child2}{child3}; print Dumper $a->{child1}{child2}{child3}{child4}; [root@devel3 root]# perl test.pl $VAR1 = { 'child1' => [ { 'child2' => [ { 'child3' => [ { 'child4' => +[ + 1 +] } ] } ] } ] }; $VAR1 = [ { 'child2' => [ { 'child3' => [ { 'child4' => [ 1 ] } ] } ] } ]; $VAR1 = undef; # hangs for 5 seconds here $VAR1 = undef; $VAR1 = undef; [root@devel3 root]#

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print