🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #533

Re: Easy Way To Determine STACK/HEAP Allocations In An .EXE?

#533
From: Duncan Murdoch
Date: Wed, 29 Jul 1992 12:35
23 lines
1700 bytes
In article <-=nm_r_.westes@netcom.com> westes@netcom.com (Will Estes) writes:
>Is there some easy way to determine the local stack and heap allocations
>in an .EXE file?  To my surprise, the DOS EXEHDR utility seems to let
>you change these parameters in an .EXE, but it doesn't seem to give a
>way to determine what those values are.  Is there some utility that will
>spit these values out, or do I just have to use debug to examine the
>.EXE header?

Borland languages come with a program called TDUMP that'll show you the
.EXE header.  However, you should be aware that most C compilers don't
use it:  they request 0 bytes, and do their own allocation of memory in the
startup code.  I doubt if it's practical to patch them to use different
sizes.

I'm not sure why they do it this way - perhaps it's for compatibility
with some ancient DOS version that didn't respect the header, or maybe
something else.   (One side effect:  the version of "spawn" which is
used to chain to another program is broken in some (all?) versions of
Borland and MS libraries.  It allocates all memory to the new program,
assuming that the new program will modify the allocation. Many don't.)

Duncan Murdoch
dmurdoch@mast.queensu.ca
Technical Details
Message-ID: <Bs5HMv.MEE@knot.ccs.queensu.ca>
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!torn!news.ccs.queensu.ca!dmurdoch
References: <-=nm_r_.westes@netcom.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.msdos.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!torn!news.ccs.queensu.ca!dmurdoch
From: dmurdoch@QueensU.CA (Duncan Murdoch)
Subject: Re: Easy Way To Determine STACK/HEAP Allocations In An .EXE?
Message-ID: <Bs5HMv.MEE@knot.ccs.queensu.ca>
Sender: news@knot.ccs.queensu.ca (Netnews control)
Organization: Queen's University, Kingston, Canada
References: <-=nm_r_.westes@netcom.com>
Date: Wed, 29 Jul 1992 12:35:19 GMT
Lines: 23