malloc bug ?

Jonathan I. Kamens jik at athena.mit.edu
Thu Mar 21 09:38:43 AEST 1991


In article <1991Mar20.142604.29925 at fmrco>, harold at fmrco (Harold Naparst) writes:
|> I have a program which is bombing with a SEGV in a call to malloc.

  When your program SEGVs inside malloc, the explanation is almost always that
you have corrupted the malloc arena at some point in the past.  Malloc tries
to use the corrupted header information in the malloc arena and dies.

|> Curiously, the problem goes away in Saber-C.

  This is curious, but not completely incomprehensible.  Saber changes the
run-time environment enough that something that may be corrupting the malloc
arena in a compiled program may not to the same thing inside Saber, possibly
because there's more free room at the end of memory blocks allocated by
malloc, so when your program overwrites a block at some point, it doesn't go
into the header of the next block.

  There is pretty much no way for us to help you figure out why your program
is SEGVing given only the information you have provided thus far.  You're
probably going to have to track down this one yourself.  Be aware that there
are several debugging malloc libraries available in the various source
newsgroup archives.

-- 
Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik at Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8085			      Home: 617-782-0710



More information about the Comp.unix.questions mailing list