Date: Sun, 28 Jun 1998 18:17:08 +0300 (IDT) From: Eli Zaretskii To: temujin AT sentex DOT net cc: djgpp AT delorie DOT com Subject: Re: Malloc problem. In-Reply-To: <359474BF.2A46@sentex.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk 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).