Yes, you are absolutely right, your example doesn't eat a memory and is
the right example how to test leaks. And here is how to test your code
with my simplifications:,
mkdir /tmp/foo
cd /tmp/foo
cpanm -n -l local https://github.com/alexbyk/mojo/archive/v6.021.tar.gz
perl -I local/lib/perl5 -Mojo -E 'while (1) { my $d =
Mojo::IOLoop::Delay->new; $d->steps(sub { $d->pass })->wait }'
You can see there are no leaks too. They work the same way. The result
is the same 100%
So the question is, which one of equal variants is better and more simple?
https://github.com/alexbyk/mojo/commit/b8a74381402120a79f206fba8043d2bfef7daf4c#diff-892d699369fe9beca14818a2019adc36
But at least this wasn't for nothing, if I am right, and other
stuff doesn't really matter - yes?
Of course it matters, always be civil, no matter how wrong the other
side of the argument might be. This is a very complicated topic, and i
would be very much surprised if either side was totally right or
totally wrong.
Case in point, your original example just kept creating delays and
registering steps, which adds a "next_tick" to the global singleton
event loop, which holds on to every single one, which then eats up a
lot of memory. That's not a circular reference problem and has nothing
to do with how the callbacks are stored. A proper test for a leak like
that would look like this one-liner.
perl -Mojo -E 'while (1) { my $d = Mojo::IOLoop::Delay->new;
$d->steps(sub { $d->pass })->wait }'
--
sebastian
--
You received this message because you are subscribed to the Google
Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.