Hi,
I keep getting a out of memory error in LuaJit. How do I increase the stack or heap size?
Thanks
Hi,
I keep getting a out of memory error in LuaJit. How do I increase the stack or heap size?
Thanks
I haven't used LuaJIT myself, other than with toy examples. But since noone else has provided any answers yet...
From skimming the documentation, LuaJIT depends on the Coco extensions to the standard coroutine library. One of the changes introduced by Coco is that the functions that create a new coroutine now take an optional argument that specifies the stack size.
Quoting the Coco docs:
coro = coroutine.create(f [, cstacksize])
func = coroutine.wrap(f [, cstacksize])
The optional argument
cstacksize
specifies the size of the C stack to allocate for the coroutine:
- A default stack size is used if
cstacksize
is not given or isnil
or zero.- No C stack is allocated if
cstacksize
is-1
.- Any other value is rounded up to the minimum size (i.e. use
1
to get the minimum size).
There is also the new function coroutine.cstacksize([newdefault])
that sets the default C stack size, as well as some corresponding changes to the C API.
Furthermore, there are numerous compile-time configuration options in the LuaJIT version of luaconf.h. There may be something in there that sets the default. On Windows, there is also a link-time setting for the executable's basic stack, set by MSVC's LINK.EXE via the STACKSIZE statement in the application's .DEF file.