[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Error in a coroutine preventing garbage collection?
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 25 Sep 2013 16:42:43 -0300
> Could you point me, please, what am I missing here? Why aren't these
> objects collected when the only strong reference to them is a local
> variable or argument inside a dead coroutine?
An error in a coroutine does not unwind its stack (see ). This is
to allow you to debug the coroutine in case of errors. So, there is
a strong reference to the coroutine (as a key in table 'list'), and
the coroutine has a strong reference to the handle; nothing can be
(In other words, an error in a coroutine is somewhat similar to an
'yield', except that you cannot resume it again.)
The difference for the coroutine that runs to completion is that,
when the coroutine finishes, 'handle' goes out of scope.