Hello, Bradley,

> Was wondering if anyone could shed some light on a problem that I am having
> with a memory leak issue.

while I not have a solution, at least I can endorse your assumption.

First, we are running several such 24/7 Event jobs for years, too. These are
clients and servers using lots of io watchers as well. As long as I can
remember, they constantly consume more and more memory when running. But
because the system uses a lot of internal and CPAN modules it seemed quite hard
to find a simple verification script - the failure could be caused by any of
these modules possibly. But now with your scripts it should be investigable,
great.

Second, I rerun your script. After a pure runtime of about 15:00 minutes
according to top, it grew from about 3 KB to 19 MB memory consumption.
(Interestingly, it still reserves about 8 KB only.)

Finally, I rewrote your wrapper a way that it performs the same task by using
IO::Select instead of Event. Both scripts were started simultaniously. While
the Event version grew up, the IO::Select version still consumes exactly the
same memory, and reserves even less (compared to the initial values).

Here is the IO::Select version of the wrapper:

- snip --

#!/usr/local/bin/perl -w
use strict;

use IO::Select;

my ($buffer, @ready);

open CHILD, "./test2.pl|" or die;

my $s = IO::Select->new();
$s->add(\*CHILD);

while (@ready=$s->can_read())
 {
  my $r=$ready[0];
  last if eof($r);
  $buffer=<$r>;
  print $buffer;
 }

- snip --

                          Jochen



Reply via email to