[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: 答复: [ 5.4 work2 ] Stack overflow causes crash
- From: Andrew Gierth <andrew@...>
- Date: Fri, 21 Dec 2018 19:34:00 +0000
>>>>> "Egor" == Egor Skriptunoff <egor.skriptunoff@gmail.com> 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.
--
Andrew.
- References:
- [ 5.4 work2 ] Stack overflow causes crash, actboy168
- Re: [ 5.4 work2 ] Stack overflow causes crash, Jonathan Goble
- 答复: [ 5.4 work2 ] Stack overflow causes crash, actboy168
- Re: 答复: [ 5.4 work2 ] Stack overflow causes crash, Roberto Ierusalimschy
- Re: 答复: [ 5.4 work2 ] Stack overflow causes crash, Andrew Gierth
- Re: 答复: [ 5.4 work2 ] Stack overflow causes crash, Roberto Ierusalimschy
- Re: 答复: [ 5.4 work2 ] Stack overflow causes crash, Andrew Gierth
- Re: 答复: [ 5.4 work2 ] Stack overflow causes crash, Egor Skriptunoff
- Re: 答复: [ 5.4 work2 ] Stack overflow causes crash, Andrew Gierth
- Re: 答复: [ 5.4 work2 ] Stack overflow causes crash, Egor Skriptunoff