delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/12/06/11:58:44

Date: Wed, 6 Dec 2000 13:04:12 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Greg Holdridge <greg AT holdridge7 DOT freeserve DOT co DOT uk>
cc: djgpp AT delorie DOT com
Subject: Re: realloc causing fault
In-Reply-To: <000501c05f64$6852d080$3e14883e@gtdf>
Message-ID: <Pine.SUN.3.91.1001206130225.11570A-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Wed, 6 Dec 2000, Greg Holdridge wrote:

> > small chunk at a time.  This will cause a massive memory fragmentation
> > in most malloc implementations (one sign of this fragmentation is that
> > the address goes up all the time, that is, memory allocated for the
> 
> Ok silly me. I did some calculations. I allocate 16 bytes per stringentry
> (including 8 byte overhead right?) and immediately afterwards I allocate a
> buffer which i presume will use the memory at the end of the stringtable.
> Therefore the stringtable cannot expand (because of the calimed memory at
> its end) and so must move leaving a fragment which will never again hold the
> table.

Exactly.  This fragmentation is the reason why your program bailed out so 
early, after exhausting all available memory.

- Raw text -


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