previous | start | next

Function Specification: find_fit

      void * find_fit(size_t asize)

      param: asize - the adjusted size (includes header and
             footer) of a free block that is requested.
      Description: Search through the linked list (or tree) of
             free blocks for a free block whose size is >= asize (the
             requested size). Remove this block from the linked list
             (or tree) and return it. If no such block is found,
             return NULL.

             With the linked list, the search could use first fit or
             next fit. Other searches (such as best fit) are
             likely to take longer and impact the throughput.

             With a binary search tree, search for the 'ceiling' - a free
             block whose size is the smallest size that is still >= asize.
             So this will implement best fit. The binary tree should
             permit faster searches and so provide acceptable
             throughput.

      Return: A free block (not on the linked list or tree of
             free blocks) whose size is >= the requested size, asize.

   


previous | start | next