Sunday, August 4, 2013

Increasing Stack Size in Visual Studio for Stack Overflow

For one of the questions in the Data Structures Program, Strongly Connected Components, there is a problem. The solution overflow:



It took me quite some time to find a solution to the stack overflow problem. I'm writing this to help everyone else facing the same problem. I saw a couple topics about this problem, but none of them offered a solution. My apologies in case I have missed it and this is a duplicate topic.

I've successfully solved the assignment using C++ with Visual Studio. To adjust the stack size you need to open Project -> "Your project's name" Properties. A dialog box opens. Find "Linker" on the left side. Now click "System". You need to change "Stack Reserve Size" and "Stack Commit Size". I put both to 400 million (it will probably work with a much lower number) and got my program to work.

Linux Question:
-Wl,-stack_size,0x10000000,-stack_addr,0xc0000000

No comments:

Post a Comment