Is there any limit on stack memory?

前端 未结 6 2028
清酒与你
清酒与你 2020-12-16 20:06

I was going through one of the threads. A program crashed because it had declared an array of 10^6 locally inside a function.

Reason being given was memory allocatio

6条回答
  •  温柔的废话
    2020-12-16 20:33

    Yes, stack is always limited. In several languages/compilers you can set the requested size.

    Usually default values (if not set manually) are about 1MB for current languages, which is enough unless you do something that usually isn't recommended (like you allocating huge arrays on the stack)

提交回复
热议问题