Subject: | Note: memory not returned to OS. |
Hello and thanks for File::Slurp.
I was using File::Slurp with some large files and I noticed memory
wasn't being returned to the OS when scalars fell out of scope, I
thought it worth mentioning, and was thinking it would be useful in the
docs.
perl -e "use strict;use File::Slurp;sub foo{print system(q{ps aux |
grep -E 'BIG|MEM'}).qq{\n}};foo();my \$t=File::Slurp::read_file
('BIG_file.txt');foo();undef(\$t);foo();"
%MEM
0.0
%MEM
5.8
%MEM
2.9
Compared to:
perl -e "use strict;sub foo{print system(q{ps aux | grep -
E 'BIG|MEM'}).qq{\n}};foo();my \$t;{local \$/;open(my
\$fh,'BIG_file.txt');\$t=<\$fh>;};foo();undef(\$t);foo();"
%MEM
0.0
%MEM
2.9
%MEM
0.0
Cheers,
Peter (Stig) Edwards