Hi Demetri Your 3d example is a bit scary. I use the following code for my native array. And I've never made any "anchoring". I was under impression that by just calling TIntArrayNative.new and let's say assigning the result to some global variable, I would not have troubles with garbage collection. Could you comment? ======================= ffi.cdef[[ #pragma pack(push, 1) typedef struct { NativeInt arr[?]; } TIntArrayNative; typedef struct { TIntArrayNative *ptr; } PIntArrayNative; #pragma pack(pop) ]] local TIntArrayNative_mt = { ... __gc = function(x) ffi.C.TIntArrayNative_gc(x.ptr) end, ... } local TIntArrayNative_ctor = ffi.metatype("PIntArrayNative", TIntArrayNative_mt) function TIntArrayFromPtr(p) return TIntArrayNative_ctor(p) end TIntArrayNative = {} function TIntArrayNative.new(n) return TIntArrayFromPtr( ffi.C.TIntArrayNative_new(n) ) end ======================== BR, Denis