lua-users home
lua-l archive

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


2014-11-19 1:28 GMT+00:00 arioch82 <arioch82@gmail.com>:
> Thanks for the explanation Andrew/Dong.
>
> so those userdata should be cleared as i initially supposed when the
> coroutine is collected but for some reason they aren't, i have event tried
> setting "tableref.co = nil" just before "tableref = nil" in the "exit"
> function but that doesn't fix it either.
>
> I am running out of ideas...

As Roberto did before, I've put your code in actual files, added a
"cbinding" module and a main script, and it shows the userdata in
myref is collected at the first garbage collection cycle. I've put it
in a repo online: https://bitbucket.org/doub/tmp-coroutine-collection.
Code works in both Lua 5.1 and Lua 5.2.

So if you want more help on that subject rather than random
suggestions, you need to craft demo code that actually shows the
problem, so we can look at it and tell you where it's wrong. Chances
are by isolating the problem you'll find the issue yourself.