Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!rutgers!cbmvax!jesup From: jesup@cbmvax.commodore.com (Randell Jesup) Newsgroups: comp.sys.amiga.programmer Subject: Re: Good Programming stops guru |||| and BNF of C++ Message-ID: <17304@cbmvax.commodore.com> Date: 9 Jan 91 21:17:24 GMT References: <1806@winnie.fit.edu> <629@caslon.cs.arizona.edu> Reply-To: jesup@cbmvax.commodore.com (Randell Jesup) Organization: Commodore, West Chester, PA Lines: 21 In article <629@caslon.cs.arizona.edu> dave@cs.arizona.edu (Dave P. Schaumann) writes: >One thing you certainly want to watch is how you use memory you get from >malloc. I recently had a bug where I said 'malloc(foo)', when I really >wanted 'malloc(foo * sizeof(int)'. Naturally, in the first version, subsequent >code stomped all over the memory past the allocated block. Unfortunately, >this contained information vital to the integrety of the free memory list. > >The result of this is at some time later (usually shortly after my program >quit) my Amiga would crash and burn. Usually with the 'memory freed twice' >guru. Ah, you need MungWall! Mungwall would catch that, and show you the trashing (as well as mostly insulate the system from the error, unless you went _way_ out of bounds). -- Randell Jesup, Keeper of AmigaDos, Commodore Engineering. {uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.commodore.com BIX: rjesup The compiler runs Like a swift-flowing river I wait in silence. (From "The Zen of Programming") ;-)