Finn Wilcox wrote: > What is a good way to check the whole heap for corruption? > > I am seeing intermittent segfaults, and I suspect a C function > and/or a Lua function is overrunning a buffer (allocated with > ffi.new.) > > valgrind does not report anything, but maybe that is because > LuaJIT's own allocator is allocating larger blocks (that are not > corrupted) and returning smaller chunks of these from ffi.new? Umm, have you read the part about Valgrind in src/Makefile? The memcheck tool only works reasonably well, when you use the system provided memory allocator (*) and turn on debug symbols. (*) Which you cannot do on x64. If that's your setup, try compiling in 32 bit mode to debug it. It's also often easier to track these corruptions in interpreter mode (luajit -joff). If that happens to make the problem go away, please read: http://wiki.luajit.org/Reducing-Testcases --Mike