www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/27/12:55:58

From: "A.Appleyard" <A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk>
Organization: Materials Science Centre
To: DJGPP AT DELORIE DOT COM
Date: Mon, 27 Jan 1997 16:26:35 GMT
Subject: A misfeature re malloc() and new
Message-ID: <957C9527FA@fs2.mt.umist.ac.uk>

### Please send a copy of the reply to me at a DOT appleyard AT fs2 DOT mt DOT umist DOT ac DOT uk,
as I had to unsubscribe from djgpp because of excessive email intray overload

By examining the source form of malloc(), it seems that if I call malloc(n),
and then free() it, the freed store can only be reused by a later malloc(p) if
n+4 and p+4 are in the same interval between successive powers of 2. That
means that if a program once needs to malloc() a very big block (say a
megabyte), and then to free() it, the store allegedly freed is not really free
for reallocation to later small malloc() calls, but is dead space. What
workrounds exist for this problem?

- Raw text -


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