Stack Space - Does it vary from PC to PC
Blitz3D Forums/Blitz3D Programming/Stack Space - Does it vary from PC to PC| 
 | ||
| On occasion I need to write recursive routines and although those I've used so far have not run out of stack space I know that it is a possibility.  Do different PCs have a different amount of stack space? Is it measureable? If so, how is it measured? | 
| 
 | ||
| It's down to the EXE and not the target machine :) So i'd imagine it was global. | 
| 
 | ||
| If it is down to the exe then does that mean that two different PCs would run out of stack space at the same time when the same code is run? | 
| 
 | ||
|  If it is down to the exe then does that mean that two different PCs would run out of stack space at the same time when the same code is run? I just did a quick test in Blitz 3D - I got a function to call itself repeatededly more than 43,000 times before the program crashed.  Strangely it didn't produce a stack overflow error as would be expected - it just stopped running.  Debug is on. Global count = 0
Recursive()
Function Recursive()
	count = count + 1
        Print count ;Added this because the code isn't producing a stack overflow error
	Recursive()
End Function | 
| 
 | ||
| heh, Yeah, the exe will crash at the same time on each PC. GFK, Unusual. in release, blitz normally just closes. Perhaps an update broke the behaveor of Debug? | 
| 
 | ||
| With Debug on, I got the same as GfK. With Debug off, it got to about 51000. I assume thats due to the debug taking some of the stack. | 
| 
 | ||
| Thanks, all very helpful. | 
| 
 | ||
| I get the same as said above, about 43K with debug on and about 51K without, no error or crash the program just exits. | 
| 
 | ||
| What actually is "stack space"? Is it how many times you can call a function from within itself? | 
| 
 | ||
| When you call a function, the return address and parameters are placed on the stack. It's just a temporary storage space. A stack is also known as a LIFO structure (Last In, First Out). | 
| 
 | ||
| Information about Stacksize seems to be in the executeables under Windows. To increase or decrease the stacksize you can use "EDITBIN.EXE" and set a new size. EDITBIN.EXE can be downloaded with the MASM32 Package. | 
| 
 | ||
| Would this changed stack size be per executable, or at a global scale? If it's global, that would be a fantastic way to destroy one's Windows installation... | 
| 
 | ||
| Per executable. :p |