<?xml version="1.0" encoding="windows-1252"?>
<node id="1014157" title="Re^2: Timing of garbage collection" created="2013-01-18 19:41:57" updated="2013-01-18 19:41:57">
<type id="11">
note</type>
<author id="171588">
BrowserUk</author>
<data>
<field name="doctext">
&lt;blockquote&gt;&lt;i&gt;Perl doesn't have "garbage collection" in the sense that it never gives memory back to the OS.&lt;/i&gt;&lt;/blockquote&gt;
&lt;p&gt;That's demonstrably not exactly true:&lt;code&gt;
C:\test&gt;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
&lt;/code&gt;

&lt;p&gt;That shows that perl allocating a 2MB scalar and then returning that 2MB back to the OS. 

&lt;p&gt;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:&lt;code&gt;
C:\test&gt;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&gt;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
&lt;/code&gt;

&lt;P&gt;That number is a around 8k less than 1MB, so presumably it is 1MB internally but then some is used for internal management.

&lt;div class="pmsig"&gt;&lt;div class="pmsig-171588"&gt;
&lt;hr /&gt;
&lt;font size=1 &gt;
&lt;div&gt;With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'&lt;/div&gt;
&lt;div&gt;Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.&lt;/div&gt;
&lt;div&gt;"Science is about questioning the status quo. Questioning authority". &lt;/div&gt;
&lt;div&gt;In the absence of evidence, opinion is indistinguishable from prejudice.
&lt;/div&gt;
&lt;/font&gt;

&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
1014100</field>
<field name="parent_node">
1014155</field>
</data>
</node>
