I run busted tests of my C/C++ module under valgrind. Because busted calls os.exit(code), Lua state is not closed, destructors of some objects are not called, which looks like memory leak for valgrind. I have an idea how to fix this. Lua >= 5.2 has optional argument "close" of function os.exit, which tells Lua to close Lua state before exiting. On Lua 5.1, workaround is calling collectgarbage() three times. before os.exit().
UPD. Another option for Lua 5.1 is not calling os.exit() at all, if exit code is success.
The text was updated successfully, but these errors were encountered:
I run busted tests of my C/C++ module under valgrind. Because busted calls os.exit(code), Lua state is not closed, destructors of some objects are not called, which looks like memory leak for valgrind. I have an idea how to fix this. Lua >= 5.2 has optional argument "close" of function os.exit, which tells Lua to close Lua state before exiting. On Lua 5.1, workaround is calling collectgarbage() three times. before os.exit().
UPD. Another option for Lua 5.1 is not calling os.exit() at all, if exit code is success.
The text was updated successfully, but these errors were encountered: