lua-users home
lua-l archive

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


Many thanks for the info.  I'm using 5.0.2

I don't change the setup, so I guess my reference has always been in the
main thread.  Now, instead of accessing the registry via the childState, I
access it via the masterState and I avoid the crash.  (And I am very happy!)

So, the only remaining question is why a childState seems to have
occasionally been GC'd even when I saved a reference to it.  I was doing
this "via" the childState, but since it should have been using the
masterState's registry anyway, I would have expected the thread to live on
until I removed the reference.  (Of course, I may have some other bug here!)

Is there any other way a thread can be GC'd.  Any special considerations for
it's yield state?

>By default, child threads share the registry with the main thread.
If you do not change that, then your references are kept at the main
registry, and therefore should not be collected. However, if you change
a child's registry, then any reference to the child in its own registry
is a circular reference, and as such is not enough to prevent GC.<