lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

Karel Tuma wrote:
> as you can see, there is something wrong with this. the "dead"
> coroutine makes "strong" reference to 'a' but there is no way
> to kill that reference in the first place. i'd understand this
> if it would be open upvalue, or the coroutine alive, but come on,
> what's purpose of completely dead coroutine's stack making strong
> references to my weak values?

Dead coroutines hold onto their stack because this is the only
way to get a backtrace if coroutine.resume() returns an error.

> solution to this should be simple: ignore references from dead
> coroutine's stack, i'm now trying to figure out how to hack this
> into lua's gc (which is the most mysterious part of lua for me :)

This is not difficult. Check L->status before marking the stack
in traversestack(). But ...

> the question is: will this break something?

Yes, see above.

Bye,
     Mike