2014-03-27 21:40 GMT+02:00 Erik Lindroos <gliptic@xxxxxxxxx>: > The LuaJIT garbage collector doesn't traverse struct members to find objects > because it doesn't know whether a pointer points to an FFI-allocated object > or not. That's expected and not scary :) > You need to keep the TIntArrayNative alive by keeping a reference to > it in a GC-reachable location (or not allocate it with plain FFI). Er-r-r. Are you sure about TIntArrayNative? TIntArrayNative is just a global table for keeping similar functions together. It's TIntArrayNative.new function that returns true native-based array. I am wondering about if TIntArrayNative.new return value is garbage collected as any other Lua value. BR, Denis