Skip to content

Instantly share code, notes, and snippets.

@hiratara
Created February 3, 2010 08:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hiratara/293465 to your computer and use it in GitHub Desktop.
Save hiratara/293465 to your computer and use it in GitHub Desktop.
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