Re: Random crashes with ABC enabled

  • From: Konstantin Olkhovskiy <lupus@xxxxxxxxxx>
  • To: luajit <luajit@xxxxxxxxxxxxx>
  • Date: Thu, 27 Mar 2014 23:57:36 +0400

2014-03-27 23:47 GMT+04:00 Denis Golovan <denis.golovan@xxxxxxxxx>:

> I am wondering about if TIntArrayNative.new return value is garbage
> collected as any other Lua value.
>

TIntArrayNative_ctor(p) will make a cdata object, which will hold
PIntArrayNative
struct and it's subject to garbage collection. Furthermore, according to
your __gc
method it will free the original C-side allocated structure as well.

If you extract .ptr member somewhere or cast your PIntArrayNative cdata
object to
e.g. void *, and loose a reference to the original object later on, you
gonna have some
trouble.

Have you tried Mike's suggestion to turn off garbage collection? If it
works fine
without it, you're likely loosing a reference somewhere.

-- 
Regards,
Konstantin

Other related posts: