malloc/free question

david newall CCDN at levels.sait.edu.au
Sat May 5 02:40:58 AEST 1990


pfalstad at phoenix.Princeton.EDU (Paul John Falstad) writes:
> They do say that their allocator looks for the "first fit," and not the
> "best fit;"

I believe their algorithm would be best described as "next fit" and not
"first fit".  Their algorithm allocates the next fit from the last block
allocated or deallocated.

A "first fit" allocater, IMHO, should allocate from the "start" every time.
This might not be very time efficient, but I observe that it doesn't suffer
from too much fragmentation.  At least, it doesn't for me.


David Newall                     Phone:  +61 8 343 3160
Unix Systems Programmer          Fax:    +61 8 349 6939
Academic Computing Service       E-mail: ccdn at levels.sait.oz.au
SA Institute of Technology       Post:   The Levels, South Australia, 5095



More information about the Comp.lang.c mailing list