in reply to Re^2: wait till memory is flushed
in thread wait till memory is flushed

I tried this code. It allocated 13% of my memory at the beginning, and it stayed at this level until the end, which means new invocation of the function does not increase the memory consumption.
sub test { my $size = 1000000; my %hash; @hash{1..$size} = (rand()) x $size; sleep 5; print keys %hash; } test(),sleep 5 for 1..10;