lua-users home
lua-l archive

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



I have a problem witch is illustrated in the following example.
Lua-API function f should return a large table. When number of entries
is small (say, 20) everything is OK, but when I put 200, program
crashes with a dialog:
---------------------------
Debug Assertion Failed!
Program: c:\lua\bin\Lua.exe
File: dbgheap.c
Line: 1044
Expression: _CrtIsValidHeapPointer(pUserData)
---------------------------

Can anyone tell me what do I do wrong?
I understand that I should increase memory limit, but what limit and where?

I'm not sure if your "low memory" conclusion is correct...

It seems to me you could be having a problem with conflicting heap managers. This issue can occur if your Lua interpreter and the DLL it loads don't share their runtime libraries. If this happens your program may operate on top of multiple heap administrations [i.e. one linked into the exe, the other one linked into the DLL]. This in turn causes a problem if one heap manager tries to free memory it did not allocate, since it won't be able to return the chunk of memory to its free list.

To see if this is your situation try and rebuild both the interpreter and your DLL and make sure they both use the dynamic runtime lib [check/change the RTL settings for both projects/makefiles/whatever]. This way the exe and DLL will both share the exact same heap admin and there shouldn't be a problem.

Ashwin.
--
no signature is a signature.