Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory leaks #8

Closed
yak1ex opened this issue Sep 28, 2013 · 1 comment
Closed

Fix memory leaks #8

yak1ex opened this issue Sep 28, 2013 · 1 comment
Assignees

Comments

@yak1ex
Copy link
Owner

yak1ex commented Sep 28, 2013

We should do undef $call when a callback loop ends.

@ghost ghost assigned yak1ex Sep 28, 2013
@yak1ex
Copy link
Owner Author

yak1ex commented Sep 28, 2013

The memory leak is reported by https://rt.cpan.org/Ticket/Display.html?id=88628#txn-1267309 as the following code:

#!/usr/bin/perl
use strict;
use warnings;
use AnyEvent;
use AnyEvent::Digest;
use Digest::MD5;

my $file = './test.flv';

my $time = AE::timer 0, 3, sub {

my $ctx = AnyEvent::Digest->new('Digest::MD5',  unit => 655360, backend => 'aio');
    $ctx->addfile_async($file)->cb(sub {
        my $ctx = shift->recv;
        print $ctx->hexdigest ,"\n";
    });
};

AE::cv->recv;

Not only aio backend but also idle backend have a memory leak.

@yak1ex yak1ex closed this as completed in d300485 Sep 28, 2013
@iakuf iakuf mentioned this issue Oct 8, 2013
yak1ex added a commit that referenced this issue Oct 8, 2013
    - Fix memory leaks by holding a loop sub reference (gh-8) (Thanks Zhou YuanYuan and iakuf@github).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant