lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Thanks Pierre,
First, you helped me and then you permited me to be aware of a tricky problem :-).

2012/2/21 Pierre Chapuis <catwell@archlinux.us>
On 2012-02-21 15:55, Mike Pall wrote:
Olivier Goudron wrote:
sk.data = ""> sv.data = "">

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




--
/*
Olivier Goudron, Formateur et Ingénieur système Linux.
Téléphone : 09 72 26 34 75
Email : olivier@goudron.fr
Site Web : http://goudron.fr
*/