Jochen,
thanx for your replay. I had tried something
similar on Thursday and found the same thing.....
However, now having said that, I am going to really
confuse you (I'm already confused). I changed the basis
of the script to use sysread() (which is what my main
script uses). Based on the size of the requested read,
I either get memory growth or I do not.
I have no clue how perl does its garbage collection,
other than to know that it is "simple and quick". I
doubt that perl combines free space that is side by
side. If that is the case, then we may be seeing a case
of memory fragmentation that is causing the growth.
BTW, I did the same thing with select() instead of
Event. The select based script did not show any memory
growth with 80 or 10240 byte reads.
If you run the script, when sysread() is set to read 80
bytes, you get memory growth. If you use something like
10240, you do not! Here is the updated script:
~~~~~ begin testevent.pl
#!/usr/local/bin/perl -w
use strict;
use IO;
use Event qw(loop unloop);
use IPC::Open2;
use POSIX ":sys_wait_h";
use FileHandle;
my $buffer;
my ($rd, $wt) = (FileHandle->new, FileHandle->new);
my $pid = open2($rd, $wt, "./test.pl");
print ("./test2.pl is running as pid $pid\n");
Event->io(fd =>$rd, cb => &\mylog);
Event::loop;
sub mylog {
my ($e) = @_;
my $fd = $e->w->fd;
sysread ($fd, $buffer, 80);
print $buffer;
}
~~~~end script
Comments?
Brad