delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/05/10/14:59:48

From: sandmann AT clio DOT rice DOT edu (Charles W. Sandmann)
Subject: Re: malloc
To: djgpp AT sun DOT soe DOT clarkson DOT edu (djgpp)
Date: Mon, 10 May 1993 13:37:32 -0600 (CDT)

Don't dismiss best fit so easily.  If you have widely ranging memory needs,
(say sizes over 6 orders of magnitude) the last thing you want to do is
expand the memory size for the 10Mb malloc() call because you are 20 bytes
short (because the previous call in a first fit put the 20 bytes there).

In a real world application (can't discuss the details) best fit reduced
the memory requirements by a factor of 4 over first fit.  These results are
only valid (in my mind at least) when the request sizes range over many
orders of magnitude.  All of the small requests are negligible compared to
requests in the largest 50%.  You want to make sure the largest 50% fit
and you don't put any small crap in those large free areas.

The memory package needs for a large scale modelling simulation is likely to be
completely different than one for an editor.

P.S.  Don't believe anyone else's studies or benchmarks.  Test it on YOUR
      program.

- Raw text -


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