www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/06/13/07:06:44

Xref: news-dnh.mv.net comp.os.msdos.djgpp:327
Path: news-dnh.mv.net!mv!news.sprintlink.net!pipex!sunic!sunic.sunet.se!erinews.ericsson.se!eed.ericsson.se!eedraq
From: Raphael DOT Quinet AT eed DOT ericsson DOT se (Raphael Quinet)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: malloc without malice
Date: 12 Jun 1995 18:55:04 GMT
Organization: Ericsson Eurolab Deutschland GmbH
Lines: 31
Sender: eedraq AT eed DOT ericsson DOT se (Raphael Quinet)
References: <DA2DKz DOT EM0 AT jade DOT mv DOT net> <2fdc5b86 DOT sandmann AT clio DOT rice DOT edu>
Nntp-Posting-Host: chapelle12.eed.ericsson.se
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Dj-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019