Mail Archives: djgpp/2001/05/05/10:50:34
> 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 -