Hello!

I have the following code which is giving me trouble, basically I was
tesing the Tibco::Rv module this was just a test program. what it does
is it creates a listener and calls a simple callback when the listener
sees a message. I ran this script but the memory use gets larger and
larger as time passes by. I understand as the callback is called more
and more times, perl reclaims the memory but never gives it back to
the
OS. So how could I modify the following code so that it runs without
consuming more memory?

Thanks!
Jim

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

my ($service,$network,$daemon) = qw(10000 ;238.238.238.238 7500);
my ( $rv ) = Tibco::Rv->new(
    service => $service,
    network => $network,
    daemon => $daemon
);

my ($listener) = $rv->createListener(
    subject => '>',
    callback => \&process_msg,
);
$rv->start;


sub process_msg {
    my  ( $msg )    = @_;
    my $content = $msg->getFieldByIndex(0);
    my $data = $content->{'data'};
    print "$msg\n";
    print $data,"\n";
    return ;
}   # ----------  end of subroutine process_msg  ----------

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


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to