home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / c / 19196 < prev    next >
Encoding:
Text File  |  1993-01-04  |  2.0 KB  |  44 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!wupost!spool.mu.edu!umn.edu!csus.edu!netcom.com!netcomsv!dms!lipson
  3. From: lipson@dms.agames.com (Pete Lipson)
  4. Subject: Re: Unsolveable bug
  5. Message-ID: <1993Jan4.181306.14608@dms.agames.com>
  6. Organization: Atari Games Corporation
  7. X-Newsreader: TIN [version 1.1 PL6]
  8. References: <C02swu.Lq2@netnews.jhuapl.edu>
  9. Date: Mon, 4 Jan 1993 18:13:06 GMT
  10. Lines: 32
  11.  
  12. Mike Bandy (bandy@netnews.jhuapl.edu) wrote:
  13. : markh@csd4.csd.uwm.edu (Mark) writes:
  14. : >   I've run into an unsolveable bug.  The bug comes from no visible error, it
  15.   - i hope there's no such beast.... :)
  16.  
  17. : >   It appears on the DOS port of the program and causes the machine to crash
  18. : >immediately after a call to malloc().  The malloc call is the ANSI-compatible
  19.  - which indicates damage to the heap links i suspect
  20. : Given your symptoms, I'd examine the PC's hardware for problems.  How
  21. : does the PC behave under other memory intensive applications?
  22.   you could TRY a ram-test.  But i just had a similar problem that i caught
  23. by substituting my own version of MALLOC.  I changed MALLOC (and FREE and
  24. REALLOC) to allocate two extra longwords. I filled the longword at the
  25. beginning and at the end of the allocated block with a recognizeable pattern
  26. and returned the address of the SECOND longword to the program.  When FREE
  27. or REALLOC is called, it checks the integrity of the validation words and
  28. complains by exiting to the debugger. Usually that's enough information to
  29. spot which array is having its bounds exceeded (the usual way of trashing
  30. a heap).  You could extend this scheme to link together all your allocated
  31. blocks and on each invocation of MALLOC you could test the checkwords; you
  32. could even add specific 'test' sprinkled through your program to narrow
  33. down your search.
  34.   If you want, i can E-mail you a sample file containing MALLOC,REMALLOC and
  35. FREE.
  36. -- 
  37.   /V\
  38. -/@-*\- Peter Lipson <-- lipson@agames.com   or   netcom!dms!lipson
  39.  \_o_/  Milpitas, CA <-- Atari Games
  40.    U
  41.