Patent ID: 7225186

Claim:
A method for managing a memory, comprising: providing a plurality of available memory blocks, each memory block having a size; providing a tree comprised of elements where each element has between 0 and 2 branches inclusive, a value, and an indicator, the indicator enabled to indicate if an element is further a hook-element, each hook-element comprising a first branch to a linked list where each element in the linked list has a value the same as the hook-element value, and a second branch to an element with a same value as the hook-element, and where each of the plurality of available memory blocks is associated with one element with the size of the associated memory block being equal to the value of the associated element; requesting an allocation of memory comprised of a request size; searching for one of the available memory blocks that satisfies the allocation request, the searching process further comprising: comparing the request size to a first value of a first element; determining if the indictor indicates the first element is a hook-element and if the first value is equal to the request size; traversing, if the indicator indicates a hook-element and the first value and request size are equal, to the hook-element's first branch; traversing, if the indicator indicates a hook-element and the first value and request size are unequal, to the hook-element's second branch; traversing, if the indicator did not indicate a hook-element and the request size is larger than first value, to a branch comprised of elements with values all greater than the first value; traversing, if the indicator did not indicate a hook-element and the request size is smaller than first value, to a branch comprised of elements with values all smaller than the first value; continuing determining and then traversing until an element that is not a hook-element and has a same value as the request value is reached, being a request element thereby; removing the request element from the tree; and making the memory block associated with the removed element available for the memory request.