Re: Making FFI callbacks call free() automatically when it's collected

  • From: Mike Pall <mike-1207@xxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Thu, 19 Jul 2012 14:17:19 +0200

Johnson Lin wrote:
> That's really strange though, since the finalizer of the object hasn't
> actually returned yet, there should still be a ref in the Lua VM to
> the object, no? How come the weak-key table can lost track of that
> beforehand?

Only userdata objects are guaranteed to be kept in weak-key tables
until the finalizer is called. There's no such guarantee for cdata

[It may turn out to be a quite expensive decision to change that.
I don't want to decide this before I'm sure it'll play nicely with
the new GC.]


Other related posts: