PID TTY STAT TIME MAJFL TRS DRS RSS %MEM COMMAND 22842 pts/1 R+ 0:00 0 10 6941 1680 0.1 perl xxx.pl create all the hashes PID TTY STAT TIME MAJFL TRS DRS RSS %MEM COMMAND 22842 pts/1 S+ 0:23 2 10 932137 883884 85.5 perl xxx.pl clean out hashes PID TTY STAT TIME MAJFL TRS DRS RSS %MEM COMMAND 22842 pts/1 R+ 0:30 31 10 932137 885632 85.6 perl xxx.pl we're done #### #!/usr/bin/perl use strict;use warnings; sub showtime { print `ps -p $$ v`; } showtime; print "create all the hashes\n"; my %h1; foreach my $one (0..64000) { $h1{$one}={}; foreach my $two (0..2) { $h1{$one}{$two}='foo'; } } my %h2; foreach my $one (0..2200000) { $h2{$one}={}; foreach my $two (0..3) { $h2{$one}{$two}='foo'; } } my %h3; foreach my $one (0..1) { $h3{$one}={}; foreach my $two (0..1) { $h3{$one}{$two}={}; foreach my $three (0..1) { $h3{$one}{$two}{$three}={}; foreach my $four (0..9) { $h3{$one}{$two}{$three}{$four}={}; foreach my $five (0..14) { $h3{$one}{$two}{$three}{$four}{$five}={}; foreach my $six (0..39) { $h3{$one}{$two}{$three}{$four}{$five}{$six}='bar'; } } } } } } showtime; print "clean out hashes\n"; %h1= (); %h2= (); %h3= (); showtime; print "we're done\n";