delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/04/20:04:07

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Segfault in malloc.
Date: Fri, 04 Oct 1996 18:42:26 -0700
Organization: Three pounds of chaos and a pinch of salt
Lines: 40
Message-ID: <3255BD02.6989@cs.com>
References: <844459022snz AT tsys DOT demon DOT co DOT uk>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp211.cs.com
Mime-Version: 1.0
To: tomw AT tsys DOT demon DOT co DOT uk
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Tom Wheeley wrote:
> 
> A reasonably large program I am writing *sometimes* crashes out with a Page
> Fault.  When I run symify, the fault appears to be in malloc
> ( _malloc+192 to be exact).  However, I suspect this is caused by a wild
> pointer of my own.
> 
> Tracing the flow, the error occurs in the middle of a lot of small mallocs
> (generally 1 - 10 bytes).
> 
> AFAICS, I have set all my pointers to be initialised to NULL, but the error
> still occurs sometimes.  I'm using -O3 at the moment.

How many blocks of memory are you trying to allocate simultaneously?  If
it is a fairly large number, then you are probably running afoul of a
well-known bug in version 1 of CWSDPMI.  This version did not have
sufficient heap space to allocate large numbers of memory blocks, and
instead of detecting this condition and returning an error, it simply
crashed your system.

For one solution, download the patch which allows you to partially fix
this problem at the following URL:
ftp://ftp.neosoft.com/pub/users/s/sandmann/csdpmi1heapfix.zip

However, the best solution is to upgrade to the latest version of
CWSDPMI, version 3, which fixes this and a couple of other bugs,
available as:
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2misc/csdpmi3b.zip

Good luck!

John

-- 
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I  |        fighteer AT cs DOT com         |
|    *  Proud user of DJGPP!  *    |   http://www.cs.com/fighteer   |
|    ObJoke:  If Bill Gates were a robber, not only would he        |
|     shoot you, but he'd send you a bill for the bullets.          |
---------------------------------------------------------------------

- Raw text -


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