Subject: | memory leak |
Date: | Mon, 27 Jun 2011 23:44:20 +0800 |
To: | bug-AnyEvent-Gearman [...] rt.cpan.org |
From: | qwer <mpashtet [...] gmail.com> |
Hello,
I find memory leak in module AnyEvent:Gearman::Client.
Function _add_task have unnamed subroutine $retry, which never undefined.
This subroutine hold $task.
$retry not undefined because $on_complete callback
(AnyEvent::Gearman::Connection module, add_task subroutine) is not calling,
when task is sended..
There is some solution:
AnyEvent::Gearman::Connection module:
sub add_task {
my ($self, $task, $on_complete, $on_error, $type) = @_;
$self->add_on_ready(
sub {
push @{ $self->_need_handle }, $task;
$self->handler->push_write( $task->pack_req($type) );
*$on_complete->(); # must have!!!!
* },
$on_error,
);
weaken($self);
return;
}
Sorry for my english:(
Best regards:)