[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Translating Linux C example to LuaJIT
- From: Justin Cormack <justin@...>
- Date: Fri, 2 Dec 2011 11:01:01 +0000
On Mon, Nov 28, 2011 at 8:25 PM, Jose <email@example.com>
I''ve converted a C example that uses Linux signals and getaddrinfo_a to LuaJIT.
The example works but I get a double free corruption sometimes. Could
anybody help me identify
where I deviate from LuaJIT best practices ?
The .lj file has the LuaJIT code. The .cdef file has the C definitions.
The attached C example is taken from
If you add collectgarbage() after the request stage and before get replies you get a free error every time - storing a pointer to a Lua reference in a C struct does not stop Lua freeing it... You allocate host2.ar_name for example as a copy of query (you can just use query directly here) and so that gets garbage collected.