www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/08/09:23:15

Date: Mon, 8 Jul 1996 16:18:01 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: "A.Appleyard" <A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk>
Cc: DJGPP AT delorie DOT com
Subject: Re: What if I run out of store?
In-Reply-To: <19C7E4A0FB5@fs2.mt.umist.ac.uk>
Message-Id: <Pine.SUN.3.91.960708160546.29655A-100000@is>
Mime-Version: 1.0

On Mon, 8 Jul 1996, A.Appleyard wrote:

>   (2) How can I trap the error condition of the stack running out of space?

AFAIK, you can't.  The main reason is that there is no such error 
condition.  When the stack overflows, it just begins overwriting the 
heap.  How fast and how hard will this cause a crash, depends on the 
program.

A tool written by Charles Sandmann is available that can be used to
determine the maximum stack space used by a DJGPP v2 executable during a
given run (note that even this is a non-trivial task).  If you want to 
release your program and suspect that it might use excessive amounts of 
stack space, you should use that tool to see how much stack does it 
actually use, then set _stklen and stubedit the executable to a value 
slightly larger than that maximum.

Since you seem to be very concerned by this issue, let me tell you 2 
things that might help you feel better:

	1) The fixed maximum stack is a ``feature'' of many other C 
compilers.  For instance, Borland C 3.x defines by default a 8KB stack.

	2) Most programs are quite happy with the 256KB default.  In fact,
a rare C program ever needs more than 50KB (I don't know about C++).  Even
GNU Emacs is only stubedited to 512KB, and it never crashed for me.  cc1
and cc1plus that sometimes need as much as 750KB are an exeception, not a
rule. 

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019