in reply to Memory consumption

Posting here was quite stimulating for thinking!!!

Solution is simple. Instead of printing dereferenced array from hash I first assign it to local variable which is printed.

# before print OUT3 join("\t", @{$hash{$data[0]}}) ."\n"; #now my @data1 = @{$hash{$data[0]}}; print OUT3 join("\t", @data1) ."\n";

I can only guess that before it was assigning some memory to anonymous array for dereferenced hash array and not releasing that memory for new cycle.

Any comments from perl memory management guru are very welcome!

Replies are listed 'Best First'.
Re^2: Memory consumption
by chromatic (Archbishop) on May 07, 2009 at 00:02 UTC
    I can only guess that before it was assigning some memory to anonymous array for dereferenced hash array and not releasing that memory for new cycle.

    That's very unlikely, or else millions of Perl programs would show the same symptoms. We'd have to see more of your program to give better suggestions.