After executing a script that uses our internal objects mapped using LuaBridge, the Lua commandline executable crashes.
**Call Stack**
Compiler.exe!l_alloc(void * ud, void * ptr, unsigned int osize, unsigned int nsize) Line 1003 C
Compiler.exe!luaM_realloc_(lua_State * L, void * block, unsigned int osize, unsigned int nsize) Line 86 C
Compiler.exe!luaH_free(lua_State * L, Table * t) Line 418 C
Compiler.exe!freeobj(lua_State * L, GCObject * o) Line 707 C
Compiler.exe!sweeplist(lua_State * L, GCObject * * p, unsigned int count) Line 743 C
Compiler.exe!luaC_freeallobjects(lua_State * L) Line 973 C
Compiler.exe!close_state(lua_State * L) Line 245 C
Compiler.exe!lua_close(lua_State * L) Line 344 C
Compiler.exe!main(int argc, char * * argv) Line 606 C
Values
ud = 0x00000000
ptr = 0x0ffb8690
osize = 32
nsize = 0
Code
static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize)
{
(void)ud; (void)osize; /* not used */
if (nsize == 0)
>{
free(ptr);
return NULL;
}
else
return realloc(ptr, nsize);
}
Error
Exception thrown at 0x50B8461D (ucrtbased.dll) in Compiler.exe: 0xC0000005: Access violation reading location 0x0FFB868C.
If there is a handler for this exception, the program may be safely continued.
Any hints on how to handle this. Apparently this might a memory allocation issue within our code but should Lua handle this properly?