🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc.programmer
Article #824

Re: Increase run-time stack size

#824
From: Steve Resnick
Date: Mon, 02 Jul 1990 01:14
32 lines
2084 bytes
In article <100010006@hpcupt1.HP.COM> swh@hpcupt1.HP.COM (Steve Harrold) writes:
>>>> Please give me some hints to avoid stack overflow. As I recall,
>>>> one can put a stack size in main() file or use switches to specify 
>>>> stack size during linking.
>-----------------
>
>Things that seem to go into the stack with Microsoft C programs include the
>environment table (in some memory models); thus you might want to reduce
>the number of superfluous variables in the DOS environment.
>

WHAT?????? The environment is in the data segment (as opposed to the stack
segment which may be the same segment but is addressed with SS as opposed to
DS). Changing the size of your environment should have no affect on running
programs. Stricly speaking the environment is not part of DOS. It's part of
COMMAND.COM and therefore should not affect the running of programs. The stack
by convention is allocated based on information in the .EXE header. There are
vendors who do not comply with this (Borland for instance) but Microsoft does.
That is what the EXEMOD and EXEHDR utilities are for. To allocate the stack
size you want, use the /ST:xxxx option for the MS linker (most other linkers
have a similar option, too). This will allocate the required number of bytes 
(indicated in xxxx) for the stack.
 
 Cheers!

 Steve

-- 
--------------------------------------------------------------------------------
Steve Resnick -<stever@octopus.COM apple!octopus!stever sun!vsi1!octopus!stever>
408/241-1533 Process Scientific, Inc.
"0x2B|~0x2B THAT is the question!"
Technical Details
Message-ID: <1990Jul2.011448.19220@Octopus.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!snorkelwacker!apple!voder!pyramid!octopus!stever
References: <32559@ut-emx.UUCP> <100010006@hpcupt1.HP.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!snorkelwacker!apple!voder!pyramid!octopus!stever
From: stever@Octopus.COM (Steve Resnick )
Newsgroups: comp.sys.ibm.pc.programmer
Subject: Re: Increase run-time stack size
Message-ID: <1990Jul2.011448.19220@Octopus.COM>
Date: 2 Jul 90 01:14:48 GMT
References: <32559@ut-emx.UUCP> <100010006@hpcupt1.HP.COM>
Reply-To: stever@octopus.UUCP (Steve Resnick )
Organization: Octopus Enterprises, Cupertino CA
Lines: 32