> Of course, Perl will never release any memory back to the O/S, but it will reuse it for its own purposes!

This is not correct. It depends on the implementation of the user-level malloc function. For more detail, see:

which notes that on Linux and Windows at least (unlike most other Perl platforms) the standard C Library malloc function does return "big" chunks of memory back to the OS.

Update: Though it's possible for a Perl built with a suitable malloc function to return memory to the OS, in practice this happens rarely, as described in ikegami's excellent Mini-Tutorial: Perl's Memory Management - which concludes with "You can't rely on memory being returned to the system, but it can happen ... if and when memory is returned to the OS is dependant on the memory allocation mechanism perl was compiled to use ... you are more likely to see memory being released to the OS on Windows".

See also:

References Added Later

Updated: minor improvements to wording; added extra references.


In reply to Re^2: Perl, C and deallocation responsibility (Returning Memory back to the OS References) by eyepopslikeamosquito
in thread Perl, C and deallocation responsibility by SheWolf

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.