lua-users home
lua-l archive

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


-----Original Message----- From: Roberto Ierusalimschy

TCC compiler:

-DLUAI_MAXCSTACK=454 is the maximum I could have it complete all tests!
-DLUAI_MAXCSTACK=455 and above crashes.

Microsoft compiler (VS2013):

-DLUAI_MAXCSTACK=413 is the maximum I could have it complete all tests!
-DLUAI_MAXCSTACK=414 and above crashes.

Tested on a Win7-64 machine with 6GB RAM (in case it matters).

Both cases the values are far below the luaconf.h default of 2200

Many thanks. This seems a remarkably small C stack for such a machine.
Are you compiling Lua in debug mode or release mode?

-- Roberto

I'm using whatever your defaults are. I only added the above define for compilation. Now, I ran cstack.lua with 5.3.5 and 5.4.0 compiled with the exact same compiler:

lua -E -e"_U=true" cstack.lua
testing C-stack overflow detection
 maximum recursion: 999977
 maximum 'gsub' nest (calls): 197
 maximum 'gsub' nest (metamethods): 197
OK

lua54 -E -e"_U=true" cstack.lua
testing C-stack overflow detection
 maximum recursion: 420
 maximum 'gsub' nest (calls): 35
 maximum 'gsub' nest (metamethods): 35
OK

cstack.lua refers to changing LUAI_MAXCCALLS which is the same (200) in both versions.
LUAI_MAXCSTACK does seem to be available in 5.3.5

Assuming the cstack.lua tests are valid also for 5.3.5, my guess from the above results is that it's not my system or compiler configurations but something in 5.4 is causing this dramatic reduction in maximum recursion. But, that's for you to decide.