Create a gist now

Instantly share code, notes, and snippets.

use strict;
use warnings;
use AnyEvent::Impl::Perl;
use AnyEvent;
use Tatsumaki::MessageQueue;
my $channel = 'test1';
my $client_id = rand(1);
my $sub = Tatsumaki::MessageQueue->instance( $channel );
my $pub = Tatsumaki::MessageQueue->instance( $channel );
foreach(1 .. 10000){
$sub->poll_once($client_id, sub { });
$pub->publish({ data => 'hello' });
# Run main loop to avoid queueing.
my $cv = AE::cv;
my $t = AE::timer 0, 0, sub { $cv->send; };
$cv->recv;
warn `ps -o rss= -p $$` if $_ % 1000 == 0;
}
__END__
% perl -Ilib check_leek.pl
5360
5360
5360
5360
5360
5360
5360
5360
5360
5360
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment