use strict; use warnings; use threads; use PDL; PDL::no_clone_skip_warning; sub mem { qx{ typeperf "\\Process(perl)\\Working Set" -sc 1 } =~ /(\d+)\.\d+\"$/m; ( my $s = $1 ) =~ s/(\d{1,3}?)(?=(\d{3})+$)/$1,/g; printf "%-30s: %12s\n", @_, $s } mem 'initially'; my $p = zeroes 50_000_000; mem 'we\'ve made a huge piddle!'; undef $p; mem 'and now it\'s gone'; sub test_arr { my @a = 1 .. ${ \10_000_000 }; mem 'we\'ve made a huge array!'; @a = undef; mem 'and now it\'s gone'; } async( \&test_arr )-> join; mem 'and now a thread is gone, too'; print "\nbut let\'s try it in main thread!\n\n"; test_arr; mem 'finally';