Path: utzoo!attcan!utgpu!watmath!maytag!watstat!dmurdoch From: dmurdoch@watstat.waterloo.edu (Duncan Murdoch) Newsgroups: comp.lang.pascal Subject: Re: Stack size in turbo pas Message-ID: <199@maytag.waterloo.edu> Date: 17 May 89 13:05:28 GMT References: <19601@adm.BRL.MIL> Sender: daemon@maytag.waterloo.edu Reply-To: dmurdoch@watstat.waterloo.edu (Duncan Murdoch) Organization: U. of Waterloo, Ontario Lines: 14 In article <19601@adm.BRL.MIL> MATHRICH@umcvmb.missouri.edu (Rich Winkel UMC Math Department) writes: >A rule of thumb I seem to remember from my asm days is to add 256 bytes >to whatever stack usage your program is responsible for. While this might >seem excessive, the price of stack overflow is pretty high. I think it's fairly unsafe in a Turbo Pascal program that does any I/O to have less than 1K more than you can see you're using. Most of the string manipulation routines (e.g. "+") allocate a full sized string (256 bytes) on the stack whether they need it or not; I'm not sure if my 1K figure makes allowances for this. A simple way to find out is to turn on stack checking, and just keep reducing the stack until you get overflows. Then add as much insurance space as you can afford. Duncan Murdoch