Re: avoiding child death by size limit
André Warnier <[email protected]>
| Newsgroups | gmane.comp.apache.mod-perl |
|---|---|
| Message-ID | <[email protected]> |
Perrin Harkins wrote: > On Fri, Dec 11, 2009 at 11:37 AM, William T <[email protected]> wrote: >> You can make sure the variables that the memory was malloc'd for have >> gone out of scope, and there are not trailing references to them. >> Perl will then reuse that memory. > > It will keep the memory allocated to the out-of-scope variables unless > you undef them. > > There's a summary of many PerlMonks discussions on this topic here: > http://www.perlmonks.org/?node_id=803515 > Perrin, that is in the end, in my personal opinion, a rather confusing discussion. So, to an extent, is your phrase above. When you say "It (perl) will keep the memory", do you mean that - the perl interpreter embedded in this Apache child will keep the memory (and not return it to the OS), but will re-use it if possible for other variable allocations happening within its lifetime ? or - the perl interpreter embedded in this Apache child will keep the memory (and not return it to the OS), and never re-use it again for any other variable allocation happening within its lifetime (in other words, this is a leak) ? Does any guru care to provide some simple real-world examples of when memory once allocated to a variable is/is not being re-used, in a mod_perl handler context ? Or pointers to ditto ? (Maybe at first independently of whether the memory also may, or not, be returned by Perl to the OS) Maybe on this last subject, what I gather from this and other discussions I've seen, is that once the Perl interpreter obtained some memory from the OS, it rarely returns it (before it exits); and if it does, it is in any case not practically predictable in a cross-platform way, so one cannot rely on it. Is that a fair interpretation ? Would it be preferable/easier if I construct some simple examples myself and present them here asking if memory allocated to "my $a" is being leaked or not ?