Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!spool.mu.edu!uwm.edu!news-peer.gsl.net!news.gsl.net!howland.erols.net!sol.ctr.columbia.edu!startide.ctr.columbia.edu!wpaul From: wpaul@ctr.columbia.edu (Bill Paul) Newsgroups: comp.unix.bsd.freebsd.misc Subject: Re: Malloc warning: free(): Date: 4 Dec 1996 17:52:56 GMT Organization: Columbia University Center for Telecommunications Research Lines: 46 Message-ID: <584dpo$o8e@sol.ctr.columbia.edu> References: <E1w1FD.JoC.G.nanguo@nanguo.chalmers.com.au> NNTP-Posting-Host: startide.ctr.columbia.edu X-Newsreader: TIN [version 1.2 PL2] Daring to challenge the will of the almighty Leviam00se, Robert Chalmers (robert@nanguo.chalmers.com.au) had the courage to say: : Malloc warning: free(): page already free. : Reported this message previously. Just following up. : I upgraded to the next 2.2 SNAP (Oct 96), but the warning still : show up int the httpd-error.log file when the web pages : 'index.html' files are accessed. Possibly others, but I havent : had time yet to do a search and try. : It happens with Apache, Zeus and NCSA servers. : Apparently its something to do with the fake malloc lib? but I'm : not sure about that. (hearsay) : Bob This is from the malloc() routine inside libc, which was written by phk. This message is usually an indication that there's a bug in the application (which is not unlikely). Calling free() on a pointer that points to memory which has already been free()ed may not cause an immediate crash, but it's not correct. Some OSes let you get away with this without any complaits, but it should be avoided. It _could_ be that there's a libc functin in FreeBSD that's doing bad things with malloc()ed memory, but I would check the server code first. Just 'cause web servers are all the rage these days, that doesn't mean they're all examples of perfect coding. A good way to test for improper use of malloc()ed memory is to link with Electric Fence, a debugging malloc() library. It will clobber your program the instant you attempt to reference memory that was already free()ed, or which falls outside the bounds of a malloc()ed buffer. -Bill -- ============================================================================= -Bill Paul (212) 854-6020 | System Manager, Master of Unix-Fu Work: wpaul@ctr.columbia.edu | Center for Telecommunications Research Home: wpaul@skynet.ctr.columbia.edu | Columbia University, New York City ============================================================================= "If you're ever in trouble, go to the CTR. Ask for Bill. He will help you." =============================================================================