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