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";
}
}
-------------------------------