home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.amiga.programmer
- Path: sparky!uunet!usc!howland.reston.ans.net!paladin.american.edu!gatech!concert!sas!mozart.unx.sas.com!walker
- From: walker@twix.unx.sas.com (Doug Walker)
- Subject: Re: SAS/C 6.1 memlib question
- Originator: walker@twix.unx.sas.com
- Sender: news@unx.sas.com (Noter of Newsworthy Events)
- Message-ID: <C0qvKB.Gw@unx.sas.com>
- Date: Tue, 12 Jan 1993 14:14:35 GMT
- References: <1993Jan12.050704.28814@gn.ecn.purdue.edu>
- Nntp-Posting-Host: twix.unx.sas.com
- Organization: SAS Institute Inc.
- Lines: 56
-
-
- In article <1993Jan12.050704.28814@gn.ecn.purdue.edu>, seifert@gn.ecn.purdue.edu (Michael S. Seifert) writes:
- |>
- |> My very dear program has a tendency to lock up after 10 to 15 minutes of
- |> use, for no immediately obvious reason. Therefore Ive broken out my group
- |> o' debugging tools, including the memlib option in SAS/C. Although I dont
- |> know if this is the problem, once in a while memlib will open a window
- |> and say:
- |>
- |> Free memory modified (or something of this sort), line 95 file ""
- |>
- |> So my question is-- what is file ""...
- |>
- |> The program uses two assembly functions and an input handler, everything else
- |> is typical c...
- |>
- |> mike
-
- This is definately a problem. I don't know why you're not getting
- the filename, but if free memory is being modified, you have a
- memory trashing bug.
-
- What's happening is this: You allocate some memory. You set some
- pointers to point into the memory. You free the memory, but don't
- clear the pointers. Sometime later, you write to the memory
- pointed to by the pointers.
-
- Memlib detects this by simply not freeing memory when you ask it to.
- Instead, it sets it to a known value and watches it. If it ever
- changes, SOMEBODY has written to memory that doesn't belong to them,
- and it's almost 100% sure to be your program using old pointers
- into it.
-
- As to the filename thing - it's possible that when the memory gets
- trashed, the filename gets trashed as well (although not likely).
- Look on line 95 in ALL your files for an allocation call. If you
- don't find any, the line number is probably trashed as well.
- It should also have given you the filename and line number that
- the memory was freed at.
-
- You do have source code to memlib. If you can't find the problem
- by the above technique, I suggest adding code to print EVERY
- allocation that comes through the memlib stuff. Then you should
- be able to figure out where it's allocated by just the address of
- the memory, using the log of when it was allocated. The bigger
- your program, the less practical this becomes, obviously.
-
- --
- *****
- =*|_o_o|\\=====Doug Walker, Software Distiller====== BBS: (919)460-7430 =
- *|. o.| || 1200/2400/9600 Dual
- | o |// For all you do, this bug's for you!
- ======
- usenet: walker@unx.sas.com bix: djwalker
- Any opinions expressed are mine, not those of SAS Institute, Inc.
-
-