www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/04/12/00:23:50

Xref: news2.mv.net comp.os.msdos.djgpp:2625
From: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: malloc crash
Date: 11 Apr 1996 07:29:39 GMT
Organization: The National Capital FreeNet
Lines: 16
Sender: ao950 AT freenet2 DOT carleton DOT ca (Paul Derbyshire)
Message-ID: <4kicd3$njj@freenet-news.carleton.ca>
References: <199604100421 DOT AA172870100 AT relay1 DOT geis DOT com> <316B7A47 DOT 381F AT matrust DOT es>
Reply-To: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire)
NNTP-Posting-Host: freenet2.carleton.ca
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I saw this happen too. I wrote a text editor that initially allocates 10K
for its buffer. As it reads in a file or as editing goes on, if it reaches
the end of 16K it reallocs it to 20K, and so forth.
When reading a file it checks after each line whether it's within one line
of the next 10K boundary, by seeing if it's up to 9744, 19744, or whatever
bytes. I accidentally had a bug where it didn't increment this properly
and still checked for 9744 bytes after passing the 10K mark, causing it to
allocate 10000 bytes every line. Then unawares I had it read in a large
file and it sat "thinking" for a while then crashed with a GPF of some
kind or another. 
--
    .*.  "Clouds are not spheres, mountains are not cones, coastlines are not
 -()  <  circles, and bark is not smooth, nor does lightning travel in a
    `*'  straight line."    ,------------------------------------------------
         -- B. Mandelbrot  |  Paul Derbyshire (PGD) ao950 AT freenet DOT carleton DOT ca

- Raw text -


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