in reply to Exiting takes a looong time

I tried to mimic what you are doing, but don't see a long delay before the exit. I don't really think the size of the data is the main reason. However, I really think you should not keep all the data in memory at each single moment (Well, literally in memory, disregarding whether the OS is swapping them out or not). Do you need all of them all the time? Even if it does not contribute to the exit problem, it would hurt the performance of your application though.
use Data::Dumper; use strict; use constant MAX_TOUCH => 30; use constant MAX_EXP => 30; use constant MAX_ROW => 20000; my $hash; my $exp; my $row; for ($exp = 0; $exp < MAX_EXP; $exp ++) { print "exp = $exp\n"; $hash->{$exp} = {}; for ($row = 0; $row < MAX_ROW; $row ++) { my $array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]; $hash->{$exp}->{$row} = $array; } } my $test; for (0 .. MAX_TOUCH) { print "touch = $_\n"; for ($exp = 0; $exp < MAX_EXP; $exp ++) { for ($row = 0; $row < MAX_ROW; $row ++) { $hash->{$exp}->{$row}[0] ++; } } } #print Dumper $hash; print "about to exit\n"; exit;