www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/07/14/20:59:30

From: jhorigan AT mipos2 DOT intel DOT com (John Horigan)
Subject: a new malloc
To: djgpp AT sun DOT soe DOT clarkson DOT edu (DJGPP mailing list)
Date: Wed, 14 Jul 93 17:21:07 PDT

I have uploaded to omnigate at pub/msdos/djgpp/pub a fast malloc routine
written by Professor Benjamin Zorn of U. Colorado, Boulder
(zorn AT cs DOT colorado DOT edu) based on his quickfit algorithm. The quickfit
algorithm is for small objects only (<= 32 bytes), larger objects
use a regular malloc. The advantage of quickfit is that the routines
malloc/free/realloc are small enough to be inlined and are very fast,
but this is only an advantage if you are allocating small objects (which
is the common case). The quickfit code is public domain but the regular
malloc included in the package is the standard Gnu malloc, which isn't
public domain. However, the Gnu malloc code can easily be replaced by
PD code. Just remove the functions __internal_malloc, __internal_free,
and __internal_realloc and replace them with the appropriately renamed
PD routines.

This malloc rounds >32 byte blocks up to the next 16 byte boundary
rather than the next power-of-two boundary so it seems to solve peoples'
memory problems except that it's Gnu copylefted.
The real solution is for GO32 to not allocate untouched heap
pages in the swap file. The problem with this is that malloc would
allocate more memory than you have swap space and you wouldn't know
until you touched more pages than you had room for and GO32 crashed. But
people put up with this under AIX so I think we could too; besides, it
allows for easy implementation of sparse data structures.

Oh by the way, the file is called quickfit.c. There is also a tar.Z file
(sorry) called customalloc-1.0.tar.Z that contains files for building an
instrumented QuickFit malloc that you run in your application to gather
info on allocation which you can then use to tailor QuickFit to your
needs. quickfit.c is simply the uninstrumented version with default
parameters.

--------------------------------------------------------------------------
John W. Horigan     GRP Engineer   Architecture Verification  M/S: RN2-27
Intel, Santa Clara  (408)765-4773  jhorigan AT mipos2 DOT intel DOT com  RNB2 pole L5

- Raw text -


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