Mail Archives: djgpp/1995/06/13/07:06:44
In article <2fdc5b86 DOT sandmann AT clio DOT rice DOT edu>, Charles Sandmann <sandmann AT clio DOT rice DOT edu> writes:
|> > I am getting a segmentation fault in malloc().
|>
|> These are almost always caused by over/under writing the allocated block,
|> which destroys the control information in the malloc control areas.
Maybe this is what you meant, but I just want to clarify this:
If the crash happens when calling malloc() itself, it means that there is
something wrong with a *previously allocated* block. In most cases, you
have been writing to memory using a pointer which points outside its block,
thus destroying the information that malloc() uses.
In other words, the statement that causes this error can be found somewhere
between the previous call to malloc() and the one that crashes (although it
could be further up).
It's a pity that good software such as Purify is not freeware, because this
provides an invaluable help when debugging that kind of errors. I had
exactly the same problem today in a large program and I found the error in
two minutes with Pufiry 3.0. I know I would have spent several hours if I
didn't have that tool. Does anybody know if there is a freeware program (or
malloc library) offering the same features as Purify?
-Raphael
--
+---------------------------------------------------------------------------+
| WWW: http://www.montefiore.ulg.ac.be/~quinet (NEW: Updated DOOM page) |
| E-mail: Raphael DOT Quinet AT eed DOT ericsson DOT se or quinet AT montefiore DOT ulg DOT ac DOT be |
| S-mail: Raphael Quinet, 9 rue des Martyrs, 4550 Nandrin (Belgium) |
+---------------------------------------------------------------------------+
- Raw text -