home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / os / msdos / programm / 8144 < prev    next >
Encoding:
Text File  |  1992-07-29  |  1.6 KB  |  35 lines

  1. Newsgroups: comp.os.msdos.programmer
  2. Path: sparky!uunet!cs.utexas.edu!torn!news.ccs.queensu.ca!dmurdoch
  3. From: dmurdoch@QueensU.CA (Duncan Murdoch)
  4. Subject: Re: Easy Way To Determine STACK/HEAP Allocations In An .EXE?
  5. Message-ID: <Bs5HMv.MEE@knot.ccs.queensu.ca>
  6. Sender: news@knot.ccs.queensu.ca (Netnews control)
  7. Organization: Queen's University, Kingston, Canada
  8. References: <-=nm_r_.westes@netcom.com>
  9. Date: Wed, 29 Jul 1992 12:35:19 GMT
  10. Lines: 23
  11.  
  12. In article <-=nm_r_.westes@netcom.com> westes@netcom.com (Will Estes) writes:
  13. >Is there some easy way to determine the local stack and heap allocations
  14. >in an .EXE file?  To my surprise, the DOS EXEHDR utility seems to let
  15. >you change these parameters in an .EXE, but it doesn't seem to give a
  16. >way to determine what those values are.  Is there some utility that will
  17. >spit these values out, or do I just have to use debug to examine the
  18. >.EXE header?
  19.  
  20. Borland languages come with a program called TDUMP that'll show you the
  21. .EXE header.  However, you should be aware that most C compilers don't
  22. use it:  they request 0 bytes, and do their own allocation of memory in the
  23. startup code.  I doubt if it's practical to patch them to use different
  24. sizes.
  25.  
  26. I'm not sure why they do it this way - perhaps it's for compatibility
  27. with some ancient DOS version that didn't respect the header, or maybe
  28. something else.   (One side effect:  the version of "spawn" which is
  29. used to chain to another program is broken in some (all?) versions of
  30. Borland and MS libraries.  It allocates all memory to the new program,
  31. assuming that the new program will modify the allocation. Many don't.)
  32.  
  33. Duncan Murdoch
  34. dmurdoch@mast.queensu.ca
  35.