English Amiga Board

English Amiga Board (http://eab.abime.net/index.php)
-   Coders. System (http://eab.abime.net/forumdisplay.php?f=113)
-   -   How much stack space do we need? (http://eab.abime.net/showthread.php?t=77435)

AGS 15 March 2015 14:39

How much stack space do we need?
 
Hi,

I am encountering various strange crashes and freezes of differen type. I thought it may be that the stack is too small for my process. So I set it to 20000. Now OS 4.1 dos once complained that it has not enough memory for process creation. Guru code: 07 0b 0000. But even this error was not reproduceable.

Any ideas?

Mrs Beanbag 15 March 2015 17:25

it would be alarming if it really couldn't reserve you a 20k stack space.

How much stack space you need obviously depends on what your application actually puts on the stack. If you are putting large objects on it or doing a lot of recursion you might need more. I've never had to increase the amount myself. But it is also possible to reserve your own space on the heap as big as you want and simply point the stack pointer at it.

maybe you have a stray pointer somewhere that is writing somewhere it shouldn't.

matthey 16 March 2015 03:13

Scout will show the current amount of free stack when looking at tasks. However, a utility which shows the max stack use is more useful for estimating the stack needs. There are several on Aminet when searching for "stack" but I don't know how good they would be under AmigaOS 4. I didn't find any on OS4Depot. Some program's stack needs are dependent on the amount of data processed or use unlimited recursive function iterations which means there is not a correct amount of default stack to give them. Compilers usually have options for automatic stack extension which can be useful in these cases but is slower overall. The PPC generally needs more stack than the 68k for alignment reasons.

The guru doesn't sound like a stack problem. If you don't have much free memory, perhaps some memory was not correcly freed.

AGS 18 March 2015 17:00

Quote:

Originally Posted by Mrs Beanbag (Post 1009919)
maybe you have a stray pointer somewhere that is writing somewhere it shouldn't.

There really was one. Solved a lot. However this guru showed up again. ;)


All times are GMT +2. The time now is 10:53.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.

Page generated in 0.04695 seconds with 11 queries