Click here to Skip to main content
15,064,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I am trying to write a Sudoku program to generate large 42x42 puzzles.
When I try and run the program I get the error "Process is terminated due to StackOverflowException"
I appear to have hit some internal limit of Visual Studio using Visual Basic
The 36x36 program works fine, but now the extra store locations and lines of code blow the stack

Is there anything I can do to make this program run?

What I have tried:

I have also tried running the program in a thread specifying the max stack size but this also does not make a difference using code

Dim ThreadA As New Thread(AddressOf MyBackgroundThreadA, maxStackSize:=4)
Posted
Updated 18-Nov-20 0:26am

You are specifying a maximum stack size of 4 bytes.
Dim ThreadA As New Thread(AddressOf MyBackgroundThreadA, maxStackSize:=4)

That is enough to hold one 32 bit integer, but not enough for a return address in a 64 bit system. So almost certainly, as soon as the Thread starts and calls the "run" method, it will exceed the available stack and your app will crash: Thread Constructor (System.Threading) | Microsoft Docs[^]

Give it the default (1MB) size or at least a reasonable 1024 bytes (if your code doesn't do or store much, or use biggish local variables.)
   
Quote:
I appear to have hit some internal limit of Visual Studio using Visual Basic
The limit is that of the stack size, which you have managed to exceed. One of the most common causes of this is recursive code which uses large amounts of stack space for local variables. You need to investigate where in your code you are consuming all the space.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900