Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!cs.utexas.edu!uunet!pdn!boake2!jc3b21!fgd3 From: fgd3@jc3b21.UUCP (Fabbian G. Dufoe) Newsgroups: comp.sys.amiga.tech Subject: Re: Catching free memory violations Message-ID: <694@jc3b21.UUCP> Date: 28 Jul 89 19:44:05 GMT References: <7408@ecsvax.UUCP> Organization: St. Petersburg Jr. College, FL Lines: 24 In article <7408@ecsvax.UUCP> utoddl@ecsvax.UUCP (Todd M. Lewis) asks about clearing free memory periodically as part of an effort to catch programs which use memory they don't own. This would work so long as you keep two things in mind. (1) The pointer to the next chunk of free memory occupies the first eight bytes of the current chunk. You can't free that. (2) If a program is writing on memory it hasn't allocated it may have clobbered one of those pointers. Consquently, you can't walk the system memory free list with any confidence. Those points aside, you could check whatever memory a chunk contains beyond the next chunk pointer to be sure that was zero. However, any application might allocate the memory, write on it, and free it without clearing it. So finding non-zero values in free memory wouldn't mean you had discovered a program which was writing on memory it didn't own. --Fabbian Dufoe 350 Ling-A-Mor Terrace South St. Petersburg, Florida 33705 813-823-2350 UUCP: ...uunet!pdn!jc3b21!fgd3