perl -e ' use strict; use warnings; print "\nInitial size:\n" . qx {ps -o rss $$}; { my %x = (); for (my $i = 0; $i < 100000; $i++) { $x{$i} = 1; } print "\nafter allocating a huge hash:\n" . qx {ps -o rss $$}; for my $k (keys %x) { delete $x{$k} } undef %x; print "\nafter deallocating the huge hash\n" . qx {ps -o rss $$}; } print "\nafter the huge hash goes out of scope\n" . qx {ps -o rss $$};'