Mail Archives: djgpp/1998/06/28/11:18:42
On Sat, 27 Jun 1998 temujin AT sentex DOT net wrote:
> Well as it turns out it was my recursive function that was causing the
> problem. When it handles more then 7500 calls to itself it seems to go
> off the deep end.
If that recursive function uses more than 35 bytes worth of local
variables, then calling it recursively 7500 times overflows the
256KB-large stack that DJGPP programs get by default. And then your
program will indeed depart into the never-never land.
You can enlarge the size of your stack by any of the methods described in
sections 15.9 and 6.4.
> Lesson I learned was that Recursion just isn't worth it.
IMHO, a more appropriate lesson would be that recursion should be only
used when necessary, and then you need to consider the stack size
available to the program. (DJGPP is not the only environment where the
stack has a fixed size which cannot be enlarged at run time).
- Raw text -