Without using recursion how can a stack overflow exception be thrown?

前端 未结 10 1950
自闭症患者
自闭症患者 2021-01-18 04:19

Without using recursion how can a stack overflow exception be thrown?

10条回答
  •  迷失自我
    2021-01-18 05:02

    If you're talking about C++ with a reasonable standard library, I image that this would work:

    while (true) {
        alloca(1024 * 1024); // arbitrary - 1M per iteration.
    }
    

    Details on alloca.

提交回复
热议问题