my @arr = (9) x 1000_000; my $code = sub { @arr }; undef $code; print(scalar(@arr), $/); # 1000000