lua-users home
lua-l archive

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


On Fri, Dec 21, 2018 at 5:24 AM Andrew Gierth wrote:
 >> local function f(s) s:gsub(".", f) return "x" end f("foo")

 Egor> On *Linux*

 Egor> Catchable error is raised:
 Egor>    Lua 5.1(all)
 Egor>    Lua 5.2(all)
 Egor>    Lua 5.3(all)
 Egor>    Lua 5.4_work2(32-bit)

 Egor> Host application crashes:
 Egor>    Lua 5.4_work2(64-bit)

This suggests you're running with a stack size limit on the close order
of 16MB, perhaps?

No.
On all my Linux machines "ulimit -s" prints "8192"

 
 Egor> On *Windows*

 Egor> Catchable error is raised:
 Egor>    Lua 5.1(all)
 Egor>    Lua 5.2(all)
 Egor>    Lua 5.3(VS 32-bit, MinGW 32-bit, MinGW 64-bit)

 Egor> Host application crashes:
 Egor>    Lua 5.3(VS 64-bit)
 Egor>    Lua 5.4_work2(all)

I am no windows expert, but I believe the stack size limit of a windows
binary can be specified at link time. So I guess MinGW is using a
different default size (presumably 2MB or more) there, and that VS's
default stack size is on the order of 1MB to 1.5MB; Lua 5.3 uses
something like 1.8MB for that code on a 64-bit build, and something
around 1MB on a 32-bit build.

You are correct.
On Windows every .EXE file has each own stack size (this value is stored in the file header).
Default stack size in applications created with VisualStudio2010 is 1 MByte, with MinGW - 2 MBytes.
So, under VS, linker option "/STACK:8388608" solves the problem for Lua 5.3.
For Lua 5.4.0-work2, stack size of 8 MBytes is not enough, but 16 is OK.
 

Roberto, what stack size does Lua 5.3+ VM expect?
This information is essential for correct building Lua on Windows.