lua-users home
lua-l archive

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


Am 18.11.2014 um 08:19 schröbte arioch82:
Hi Sean,

Hi!


thanks for your reply.

I have tried forcing several collections manually on the C side after that
call and the userdata are not collected, there are no more references to
that userdata as the one shown in the snippets that's why i feel i am
missing something.

Given the right options microscope[1] can display registry table, environments, upvalues, locals (in the main thread and in other coroutines), i.e. most places where a leaked reference could be. (Beware: Images of complete Lua states tend to be huge, and Graphviz[3] has issues with rendering huge graphs in bitmap formats). luatraverse[2] can do similar things in plain text format (so without the Graphviz dependency).


I was thinking that maybe since the coroutine is in a yield status in that
and since it has the "self" parameter it keeps a reference to the "tableref"
that will never be cleared?
What would be the right approach in the case? I know that coroutines cannot
be killed manually.

If the suspended coroutine is still reachable and has a reference to the userdata on its stack, then the userdata won't be collected. You'd have to make sure that there are no more reference to the coroutine to free that userdata reference on the coroutine stack.


Thank you again


Philipp

  [1]: https://github.com/siffiejoe/lua-microscope/
  [2]: http://code.matthewwild.co.uk/luatraverse/
  [3]: http://www.graphviz.org/