Could somebody please explain the following: // test.cpp extern "C" __declspec(dllexport) int luaopen_test (lua_State *L) { char *buf = new char; delete buf; lua_newtable(L); return 1; } I do the following: luajit.exe -ltest LuaJIT 2.0.3 -- Copyright (C) 2005-2014 Mike Pall. http://luajit.org/ JIT: ON CMOV SSE2 SSE3 fold cse dce fwd dse narrow loop abc sink fuse Then I press CtrlZ Enter and get an exception message box: ---------------------------------------------------------------- luajit.EXE - Application Error The exception Breakpoint A breakpoint has been reached. (0x80000003) occurred in the application at location 0x10003c38. ---------------------------------------------------------------- Details: * MinGW toolchain was used (g++ 4.7.1 or 4.8.1 - no difference). * Exception occurs only if operator `new` was called and it occurs on luajit.exe exit, rather than at the time `new` was called. * Windows XP SP3 x86 -> EXCEPTION. * Windows 7 x64 (but same 32-bit binaries) -> OK. * Windows XP + lua.exe (PUC-Rio) + lua5.1.dll (PUC-Rio) -> OK. * Windows XP + lua.exe (PUC-Rio) + lua5.1.dll (LuaJIT) -> OK. Summary: 3 factors are needed to cause the exception: 1) call operator `new' 2) luajit.exe (lua.exe is OK; DLL doesn't matter) 3) Windows XP (Windows 7 is OK) Thank you. -- Shmuel