in reply to Re: Lots of memory usage with fork&copy
in thread Lots of memory usage with fork&copy

Here is a image of resources usage:
http://img266.imageshack.us/img266/6838/perlfh2.png
The memory grows until I suspend the process (or windows says: Enough memory, Rest in Peace! ;) ).

The "use Win32;" follows: http://img266.imageshack.us/my.php?image=perlokvu7.png

As i said before "I run this scripts with perl v5.8.8 on Windows XP. (Binary build 817, ActiveState, 20 Mar 2006)."

I've tried it with both an empty file and a 49MB file. With and empty file the memory usage grows faster because it forks faster.

I've run the scripts on local files.

Edit: g0n - linkified web links

  • Comment on Re^2: Lots of memory usage with fork&copy

Replies are listed 'Best First'.
Re^3: Lots of memory usage with fork&copy
by BrowserUk (Patriarch) on Apr 27, 2007 at 16:12 UTC

    FYI: The use of a fileshare and File::Copy are both incidental to the problem. The following one-liner demonstrates the memory growth under both 5.8.8 and 5.9.5.

    The second one-liner also demonstrates that use Win32; definitely has the effect of slowing the growth rate:

    ## leaks rapidly. The sleep just avoids a fork bomb. \as817\perl\bin\perl.exe -le"while(Win32::Sleep 10){$p=fork and waitpi +d($p,0) or print(qq[kid:$$]),exit}" ## This leaks more slowly \as817\perl\bin\perl.exe -mWin32 -le"while(Win32::Sleep 10){$p=fork an +d waitpid($p,0) or print(qq[kid:$$]),exit}"

    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.
      With waitpid (used in that form) you won't create a fork bomb so there's no need for sleep. I'll test on monday with an older perl if I'll found an installation kit on the internet.
Re^3: Lots of memory usage with fork&copy
by BrowserUk (Patriarch) on Apr 27, 2007 at 15:03 UTC

    Sorry. That's the problem with coming to the party late, you tend to miss what has gone before. In this case, the reference to 5.8.8/AS817. I was using AS811/5.8.6 which I have stuck with in preference to 5.8.8 as I have encountered several anomolies with the latter.

    I just repeated my tests using AS817 and replicated your results exactly. I also tried it with 5.9.5 (current - 10 days), and found that it produces similar results to 5.8.8, so it looks like bug introduced since 5.8.6 is responsible. Worth raising a perl-bug report I think.


    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.