Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bbn!gatech!mcnc!ecsvax!utoddl From: utoddl@ecsvax.UUCP (Todd M. Lewis) Newsgroups: comp.sys.amiga.tech Subject: Catching free memory violations Keywords: FreeMem monitor debug memory spam Message-ID: <7408@ecsvax.UUCP> Date: 27 Jul 89 17:37:43 GMT Organization: UNC Educational Computing Service Lines: 29 I have a program which seems to use memory it doesn't own from time to time, and I'd like some way to catch it in the act. I've been thinking about a method to see if/when it messes up free memory, and I'd like to know why this wouldn't work: * Zap FreeMem() to zero out memory whenever it is freed. * Zero out all memory which is already freed. * Periodically scan all free memory to see if it is still zero'd out. If it isn't, report the address range that has been munged (so you know about it) and optionally zero that RAM (and see who dies:). Because of the overhead this would put on the system you probably wouldn't want to run it all the time, but during software development and testing this could be handy to have around. It wouldn't catch writing over another program's data/code, but it could catch some illegal uses of free RAM. What I'd like to know is: 1 Would this work? What are the pitfalls of this method? 2 Has it already been done? 3 Would anybody else be interested it this? Todd M. Lewis, utoddl@ecsvax.uncecs.edu, utoddl@ecsvax.bitnet To quote Eugene H. Spafford, "Crisis and Aftermath", Communications of the ACM, vol. 32, no. 6, (June 1989), p. 684: "It is curious that this many people [...] would assume to know the intent of the author based on the observed behavior of the program."