Hi lua-lIn my application ( C++ as dll , C++ CLI as wrapper and C# for ui), the problem comes form the dll. In dll i used lua and started a thread , in this thread , i create a lua_state and use luaL_loadfile to load a script and allocate memory for string use using malloc and the lua process the script chunk successfully. Before exit the thread , i close the lua_state, free the memory , but when i start the thread again, the lua load file error in luaL_loadfile . In Debug version ,all works fine as well as debuging the Release Version , but when running the Release Version , it directly leads to the crash of the application.the lua is linked static to the dll.i found the error comes form :ldo.c:luaM_freearray(L, p.dyd.actvar.arr, p.dyd.actvar.size);so i think whether this function comficts with malloc.....any help?