-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
segfaults in ffi::newctype #27
Comments
this doesn't even look like our bug, but possibly a bug in Lua itself (in its garbage collector) you should try different versions as well, and make sure you have the latest version of 5.4 (currently 5.4.2) |
Thanks for the hints. free(): invalid next size (normal)
Aborted or malloc(): invalid size (unsorted)
Aborted Could these messages be generated by I could not yet pinpoint the problem to a minimal example. Maybe it is related to my application mixing Lua and direct C allocations / free? In principle I only |
well, might be our bug but without a testcase there isn't really anything i can do these messages are generated by glibc's memory allocator |
@q66 I finally found out the reason of the memory errors in my application. It looks like structures with arrays of dimension larger than one have wrong size. E.g. the following currently fails with local ffi = jit and require('ffi') or require('cffi')
ffi.cdef([[
struct transform {
double matrix[3][3];
};
]])
assert(ffi.sizeof('struct transform') == 3 * 3 * ffi.sizeof('double')) The structure has a size of Note that |
I see, that would explain it... |
okay, that should be fixed now... thanks for reporting |
Thanks for the patch. It works fine now :) |
Hello,
thank you for the previous patches.
I am currently stuck with the following issue. When running a "complex" program at some point I get segfaults in
ffi::newctype
. Below is a typical example of a trace obtained with gdb:Unfortunately I could not reproduce this issue with a minimal example. The segfaults happen in several of my use cases and are always triggered by the previous sequence:
ffi::newctype
/sweeplist
. It does not happen on the first call toffi::newctype
but rather after O(100) calls or so.Sorry, this is not very helpful but I don't know what to check at this point? Please, let me know if there are extra values that would be meaningful to be printed out, e.g. using
gdb
?When using
LuaJIT/ffi
I have no segfaults.The text was updated successfully, but these errors were encountered: