lua-users home
lua-l archive

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

>>>>> "Egor" == Egor Skriptunoff <> writes:

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

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

Right, so 8MB. As I said in the other message, I overestimated the 5.4
stack usage for that recursive gsub by 2x due to not accounting for the
depth being incremented twice for each recursion, not once.

But that of course leads to the question: is there a way to make 5.4
recurse such that there's a buffer on the stack for each C call level?
And it turns out that yes, there is:

print(setmetatable({},{__index=table.concat, __len=function() return 1 end})[""])

C stack overflow at call depth 2200, stack 18772305 bytes

I think that's probably the largest stack depth possible with the
default compile options and no modules.