Re: Lua JIT FFI bug ?
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Lua JIT FFI bug ?
- From: Pierre Chapuis <catwell@...>
- Date: 2012年2月21日 16:07:19 +0100
On 2012年02月21日 15:55, Mike Pall wrote:
Olivier Goudron wrote:
sk.data = ffi.new("char[255]")
sv.data = ffi.new("char[255]")
Garbage collected values must be anchored (in a local variable,
Lua table, etc.). A pointer inside a cdata struct is not
considered an anchor.
Not a bug. Read: http://luajit.org/ext_ffi_semantics.html#gc
Hmm, yes, my bad for answering your former question incorrectly...
Things like these are rather tricky. Another alternative is to
call ffi.c.malloc() to allocate the memory, since it is not
garbage collected (but then you have to free it manually too).
--
Pierre Chapuis