Re: ffi: callback lifetime

  • From: Cosmin Apreutesei <cosmin.apreutesei@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Fri, 18 May 2012 16:34:37 +0300

> Nope. Callbacks are never subject to GC. That's because in general
> the VM cannot tell how long the C side may hold onto the callback
> address. But you can tell -- by reading the docs. :-)

But this logic can be applied to any resource that you pass a pointer
to, not just callbacks, and sometimes you do need to anchor them to
avoid gc'ing :)

Other related posts: