我正在尝试在 64 位 Linux 下调试基于 luajit 的应用程序的一些问题。
该脚本通过 FFI 回调多个库,我正在尝试找出一些内存损坏问题。 Valgrind 通常是我选择的工具,但是我发现 luaL_newstate 在 Valgrind 下运行时会失败。
经过一番研究后,我发现标准 luajit 也无法加载。我认为这可能是 valgrind 的问题而不是 luajit 的问题。有没有办法给 valgrind 更多的内存?
最佳答案
如果您使用的 valgrind 版本从 3.9.0 版本开始一直到(但不包括)3.11.0 版本,则可能是问题所在。
这些版本似乎在使用 luajit 的 x86_64 上“损坏”。
参见this email来自迈克·帕尔:
[Note that Valgrind 3.9.0 has chosen to block MAP_32BIT, which breaks LuaJIT on Linux/x64:
https://bugs.kde.org/show_bug.cgi?id=324181
Older versions of Valgrind still work. It wasn't that useful to debug LuaJIT on x64, anyway, due to the mandatory use of the builtin allocator. But none of that relates to your problem.]
关于luaL_newstate 在 valgrind 下没有成功?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33905301/