lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Is it possible you have more than one heap in release and you are getting cross-heap problems?

When you run in debug, is absolutely all of your code compiled in debug with the same compilation settings?  Now when you run in release is this still the case?

In some cases mixing debug/release versions causes the C runtime to effectively run 2 different heaps.  It sounds to me like the one of two things.

First possibility, the cleanup of your first instance is bad.  Possibly you are mangling the lua stack and then in release lua is corrupting the heap upon exit because its stack is wrong.  

Another one is that you are overwriting memory while running and this has no effect in debug because things are allocated with more boundary bytes but in release you are thrashing part of the lua system.

In any case nothing in lua conflicts with malloc; the error is a corrupt heap due to a problem.


On Fri, Apr 19, 2013 at 8:58 AM, wingstrife <> wrote:
Hi lua-l
    In 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 :
luaM_freearray(L, p.dyd.actvar.arr, p.dyd.actvar.size);
so i think whether this function comficts with malloc..... 
any help?

A foolish consistency is the hobgoblin of little minds - Emerson