Date: Wed, 6 Dec 2000 13:04:12 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Greg Holdridge cc: djgpp AT delorie DOT com Subject: Re: realloc causing fault In-Reply-To: <000501c05f64$6852d080$3e14883e@gtdf> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 Precedence: bulk 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.