previous | start | next

Function Specification: place

      void * place(void *bp, size_t asize)

      param: bp - pointer to a free block, not on the linked
             list or in the tree of free blocks whose size is >= asize
      param: asize - the requested size of a free block
      Description: Determines if the block bp has size big
             enough to split into a block of the requested size and
             a free block. In order to split, the extra size >
             asize must be big enough to hold the header, footer, a
             non-empty payload and must have total size that is a
             multiple of the alignment (8). 

             If the block is split, the allocated part is marked
             allocated and the free part is marked free and
             the free part must be inserted into the linked list (or tree)
             of free blocks. 

             If the block is not split, it is simply marked allocated.

             Suggested Optimization: If the block is to be
             split, the allocated part should be taken from the
             'small' end of the block if the requested block is
             'small'; otherwise, it should be taken from the 'big' end.

      Return: A pointer to the allocated block.

   


previous | start | next