lua-users home
lua-l archive

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


My guess would be that there are objects in that lua_State you are use that should be garbage collected but has not been yet. These objects were allocated on the EXE heap as well as the state itself. lua_dofile allocates a bunch of objects on the DLL heap and as a side effect triggers garbage collection. During garbage collection DLL heap is used as the DLL has been linked statically (I would presume) to lua library and those object allocated on EXE heap cause the problem, as they don’t exist on the DLL heap.

 

In order to avoid the problem, you may change the default Lua allocation routines to use HeapAlloc/HeapFree with the process heap (GetProcessHeap()).

 

Alex.

 

-----Original Message-----
From: Mihai Cozma [mailto:meeshoo@go.ro]
Sent: Tuesday, May 27, 2003 11:59 AM
To: lua@bazar2.conectiva.com.br
Subject: lua states

 

hi.I have an application and a dll wich is loaded when the application starts.i create a lua thread in the application as a member of a c++ class.then i send the lua_State pointer of this thread to the dll and there is stored in a variable of the same type.what i want to do is to run code from the dll in the thread created in the application, but i get a run-time error:the memory cannot be read and there  are some addresses.i've checked the debugger and the problem appears when i call lua_dofile with the state i was talking about as the first parameter.how can i do it without getting the error?please answer me as quickly as u can.

 

mihai cozma