http://www.perlmonks.org?node_id=1014157


in reply to Re: Timing of garbage collection
in thread Timing of garbage collection

Perl doesn't have "garbage collection" in the sense that it never gives memory back to the OS.

That's demonstrably not exactly true:

C:\test>perl -E"say `tasklist|find \"$$\"`; $x=chr(0); $x x= 2e6; say +`tasklist|find \"$$\"`; undef $x; say `tasklist|find \"$$\"`" perl.exe 139252 Console 1 4 +,660 K perl.exe 139252 Console 1 6 +,680 K perl.exe 139252 Console 1 4 +,724 K

That shows that perl allocating a 2MB scalar and then returning that 2MB back to the OS.

On my Perl/system, the break point for the size of allocations that are released back to the system is 1040351 bytes. anything more and it is; less and it is not:

C:\test>perl -E"say `tasklist|find \"$$\"`; $x=chr(0); $x x= 1040352; +say `tasklist|find \"$$\"`; undef $x; say `tasklist|find \"$$\"`" perl.exe 129340 Console 1 4 +,688 K perl.exe 129340 Console 1 5 +,788 K perl.exe 129340 Console 1 4 +,780 K C:\test>perl -E"say `tasklist|find \"$$\"`; $x=chr(0); $x x= 1040351; +say `tasklist|find \"$$\"`; undef $x; say `tasklist|find \"$$\"`" perl.exe 241476 Console 1 4 +,704 K perl.exe 241476 Console 1 5 +,788 K perl.exe 241476 Console 1 5 +,792 K

That number is a around 8k less than 1MB, so presumably it is 1MB internally but then some is used for internal management.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.