Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!gatech!ncsuvx!mcnc!ecsvax!utoddl From: utoddl@ecsvax.UUCP (Todd M. Lewis) Newsgroups: comp.sys.amiga.tech Subject: Re: Catching free memory violations Summary: I'd like to break that program. Message-ID: <7422@ecsvax.UUCP> Date: 1 Aug 89 18:48:04 GMT References: <7408@ecsvax.UUCP} <694@jc3b21.UUCP> <3985@cps3xx.UUCP> Organization: UNC Educational Computing Service Lines: 31 In article In article <3985@cps3xx.UUCP>, usenet@cps3xx.UUCP (Usenet file } Robin> owner) writes: } porkka> Forbid(); } porkka> FreeMem(x,len); } porkka> playsomemore(x); } porkka> Permit(); } } porkka> Now if you go zeroing things out at the FreeMem call, you can } porkka> potentially screw somebody up. } } Robin> FreeMem is just that. It gives the memory _back_ to the system } Robin> which is then free to tag and use the memory anyway it wants } Robin> to. Using free'd memory is a bad habit. Get rid of it. It does } Robin> not work. Forbid() doesn't help. } } And yet, it IS assumed to be safe, if you're forbidden. (It *may* } even be (semi) officially sanctioned. But I wouldn't count on it.) } Regardless, people *expect* this to work, and it would help not to } break it without needing to. I don't assume it is safe. In fact I will gladly take steps to detect such usage and purge that software from my disks. What do you think will happen to the above program when an MMU is running? No, if you want to mung around with memory, don't free it first. -- Todd