Article View: comp.sys.amiga.tech
Article #674Re: Catching free memory violations
From: Todd M. Lewis
Date: Tue, 01 Aug 1989 18:48
Date: Tue, 01 Aug 1989 18:48
31 lines
1778 bytes
1778 bytes
In article <SHADOW.89Jul31154235@pawl.rpi.edu}, shadow@pawl.rpi.edu (Deven T. Corzine) writes: } } On 30 Jul 89 21:27:01 GMT, } rosenber@ra.abo.fi (Robin Rosenberg INF) said: } } Robin> 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
Technical Details
Message-ID:
<7422@ecsvax.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!gatech!ncsuvx!mcnc!ecsvax!utoddlReferences:
<7408@ecsvax.UUCP} <694@jc3b21.UUCP> <3985@cps3xx.UUCP> <SHADOW.89Jul31154235@pawl.rpi.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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> <SHADOW.89Jul31154235@pawl.rpi.edu> Organization: UNC Educational Computing Service Lines: 31