hello,

I've searched a lot but I couldn't find a really similar thread. Please give me a pointer where to find this info or where to ask/report a bug.

Below you'll see two similar versions. First one uses lots of memory; after every call of copy function it aquires more memory and it seems perl won't release it although I do a exit & waitpid. The other strangely uses a lot less memory (it still seems to be eatting memory but no that much).

I run this scripts with perl v5.8.8 on Windows XP. (Binary build 817, ActiveState, 20 Mar 2006). I've run the first script (the one without use Win32) on Linux and it seems to work just fine (I guess this could be a platform implementation problem). Changing copy() with Win32::FileCopy() gives no real benefit (it still seems to eat up memory (slowly, but it's there)).

Any suggestions are welcomed. If possible please don't suggest not to use fork.

Best regards,
andrei

Quoted files follow:


http://rafb.net/p/eKup5083.html
------------------------------- use strict; use warnings; use File::Copy "copy"; while (1) { my $pid; $pid = fork(); if ($pid == 0) { copy("a", "b"); exit 0; } else { print "Pushing $pid\n"; print "\tWait : " . waitpid($pid, 0), "\n"; } }
-------------------------------

http://rafb.net/p/DkM9im72.html
-------------------------------
use strict; use warnings; use Win32; use File::Copy "copy"; while (1) { my $pid; $pid = fork(); if ($pid == 0) { copy("a", "b"); exit 0; } else { print "Pushing $pid\n"; print "\tWait : " . waitpid($pid, 0), "\n"; } }

-------------------------------

In reply to Lots of memory usage with fork&copy by andreidf

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.