Jump to content
  • Advertisement
Sign in to follow this  
Elwren

Increase stack size?

This topic is 3922 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to do some analysis using a very deep recursive call routine and I am getting StackOverflowExceptions being thrown. I know that it is not an infinite recursion/loop and it is just the stack being maxed out so I was wondering if there was a way to increase the stack size? I've looked around the web and all I've learned is that the stack is typically 1MB big so I would like to make it 2MB for this analysis. Any thoughts? Some places mentioned using some "/f [size]" in the command line but it wasn't working for me for something. I'm using Visual C# Express Edition 2005. Thanks!

Share this post


Link to post
Share on other sites
Advertisement
In those situations, it's possible to emulate recursion using your own stack or queue, allocated on the heap.

A (preorder) tree traversal, for example:

stack.push(root)

while stack is not empty:
parent = stack.pop()
visit(parent)
foreach node in parent.children:
stack.push(node)

Share this post


Link to post
Share on other sites
If you have MSVC installed, you can use the editbin utility to change the default stack size for your executable. Ex:

editbin /stack:10000000 MyProgram.exe

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!