delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/05/05/10:50:34

Date: Sat, 05 May 2001 17:51:14 +0300
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: Dennis Yelle <dennis51 AT jps DOT net>
Message-Id: <7458-Sat05May2001175113+0300-eliz@is.elta.co.il>
X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9
CC: djgpp AT delorie DOT com
In-reply-to: <3AF40A31.B7EC98B7@jps.net> (message from Dennis Yelle on Sat, 05
May 2001 07:12:01 -0700)
Subject: Re: new doesn't throw an exception
References: <3AF329A4 DOT 1B8469DE AT jps DOT net> <2950-Sat05May2001092233+0300-eliz AT is DOT elta DOT co DOT il> <3AF40A31 DOT B7EC98B7 AT jps DOT net>
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

> From: Dennis Yelle <dennis51 AT jps DOT net>
> Newsgroups: comp.os.msdos.djgpp
> Date: Sat, 05 May 2001 07:12:01 -0700
> 
> There is a bug in malloc for small allocations.
> malloc() first rounds the size up to a multiple of 8 then
> if it needs to call sbrk, it adds another 16 (instead of 8) to handle the
> case that sbrk returns a noncontiguous chunk, if sbrk returns
> a contiguous chunk, malloc does not reclaim the excess bytes.

I don't think this is a bug, but you are welcome to make a change,
test it for a while, and then send the patches to
djgpp-workers AT delorie DOT com.

> It is pretty silly to ask sbrk for only 24 bytes each time, 
> especially when we only really need 4 bytes.

The assumption is that most programs don't allocate too many 4-byte
chunks.  This is a very inefficient way of using memory, on any
system.

Note that DJGPP's sbrk allocates memory in chunks of 64KB anyway.

- Raw text -


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