larue@motcid.UUCP (Monty T. LaRue) (12/05/90)
bg0v+@andrew.cmu.edu (Brian M. Gottier) writes: >I am working on a project for my software engineering class that is due >Monday, so prompt responses would be greatly appreciated. >My program is currently overflowing the stack. I can't figure out how to >increase the stack size. The description of the global variable _stklen in >the reference manual says that the default is 4K. This is what my program is >using. I am compiling using the huge memory model so the text indicates that >the stack has its own segment. However, by default only 4K of that is used >(ie. sp register starts at 0x1000). The text (for _stklen again) indicates >that you can change the stack size. You don't just change this variable >though. Apparently it is readonly and just indicates the compiled stack size. >Setting the variable has no affect on the stack size. >So how does one change the stack size? >By the way, I am using Turbo C ver 2.0. >Thanks!!!! >-Brian >bg0v@andrew.cmu.edu Note: The following is based on Turbo C++ v1.0, but I don't think there is a difference. I recently wrote a recursive Quick sort (again in TC++) and had stack troubles. I was able to alter the stack in the large memory models (compact, large, and huge), but I could not get the maximum 64k. I bumped up the stack as follows: My includes: stdio.h, stdlib.h & mem.h /* The only ones you `might' need */ Global declaration (outside of any functions including main): extern unsigned _stklen = 0xffee; /* Stack = 65518 */ Do a printf to verify the stack size is 65518: (void) printf ("Stack size is %u.\n", _stklen); Good Luck! -- +------------------------------------+----------------------------------------+ | Monty LaRue @ Motorola Cellular | "Now that I know we can survive it, | | <PH: (708) 632-2602> | I'd like to try it again." | | <uunet!motcid!larue> | -- Dewey Duck |