Was wondering if anyone could shed some light on a problem that I am having with a memory leak issue.
I have a perl script, based on event.pm that will be running 7/24. The script manages the execution multiple processes, logging all interactions to a log file. The script takes commanding from sockets that our operators can connect to. During the running of the script, memory usage for the process goes up. In trying to figure out why, I have come up with a couple of demo scripts that show the problem in an accelerated fashion. Here are the particulars: Hardware: Sun Ultra-10 OS: Solaris 7 Perl ver: 5.6.1 Event.pm ver: 0.85 The sample scripts opens up a pipe to a sub-process and sets up an io event on input. The child process goes into a loop writing out a line of text that includes a counter. I don't bother sleeping between each print to speed up the memory leak. As it stands, the test.pl script average a growth of about 10MB/hour. While the real life program is much slower, you can see why this is no good for a 7/24 operation. Here are the scripts: Here is test2.pl, the sub-process: #!/usr/local/bin/perl -w use strict; my $i = 1; while (1) { print "Just a string with a counter that is now at ", $i++, ".\n"; } ##### End of test2.pl Here is the main script (test.pl): #!/usr/local/bin/perl -w use strict; use Event qw(loop unloop); my $buffer; open CHILD, "./test2.pl|"; Event->io(fd => \*CHILD, cb => \&mylog); Event::loop; sub mylog { my ($event) = @_; my ($fd) = $event->w->fd; return if eof($fd); $buffer = <$fd>; print $buffer; } ##### End ./test.pl I also have another version that uses FileHandle and open2 for the sub-processes (this is what the real script uses). In that case, I don't have to worry about the "return if eof($fd);" line. In either case, they both have memory leaks. Hopefully, I copied those two scripts correctly here. If anyone has any ideas, please let me know. Thanx. Brad Brahms