你可以在c ++中设置调用堆栈的大小吗? (vs2008) [英] Can you set the size of the call stack in c++? (vs2008)
问题描述
我从一个示例代码块中分配一个相对较大的局部数组。 (32768要精确)当我尝试同样的,我得到的行为,似乎是一个堆栈溢出。现在我想知道,如果我的例子可能设置堆栈比我的应用程序更大。这可能吗?
I'm working from an example piece of code that allocates a relatively large local array. (32768 to be precise) When I try the same I'm getting behaviour that appears to be a stack overflow. Now I was wondering if my example has maybe set the stack to be larger then my application. Is this possible? if so how?
推荐答案
使用Microsoft编译器,您可以使用 / F 来设置堆栈大小,但是它似乎应该只是在堆上分配对象。你应该有一个原因,你在堆栈而不是堆分配这。
With the Microsoft compiler you can use /F to set the stack size, however it seems like you should just allocate the object on the heap. You should have a reason you're allocating this on the stack rather than the heap.
编辑:此页面提供了一个很好的跨平台细分,尽管它可能已过时。
This page gives a good cross-platform breakdown, though it may be dated.
这篇关于你可以在c ++中设置调用堆栈的大小吗? (vs2008)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!