def add_space(address, size)
      node = self

      loop do
        if node.size == 0
          # This happens only for the root node if the tree is empty.
          node.set_size_and_address(size, address)
          break
        elsif size < node.size
          # The new size is smaller than this node.
          if node.smaller
            # There is already a smaller node, so pass it on.
            node = node.smaller
          else
            # There is no smaller node yet, so we create a new one as a
            # smaller child of the current node.
            node.set_link('@smaller',
                          SpaceTreeNode::create(@tree, address, size, node))
            break
          end
        elsif size > node.size
          # The new size is larger than this node.
          if node.larger
            # There is already a larger node, so pass it on.
            node = node.larger
          else
            # There is no larger node yet, so we create a new one as a larger
            # child of the current node.
            node.set_link('@larger',
                          SpaceTreeNode::create(@tree, address, size, node))
            break
          end
        else
          # Same size as current node. Insert new node as equal child at top of
          # equal list.
          new_node = SpaceTreeNode::create(@tree, address, size, node)
          new_node.set_link('@equal', node.equal)

          node.set_link('@equal', new_node)

          break
        end
      end
    end
def add_space(address, size)
      node = self

      loop do
        if node.size == 0
          # This happens only for the root node if the tree is empty.
          node.set_size_and_address(size, address)
          break
        elsif size < node.size
          # The new size is smaller than this node.
          if node.smaller
            # There is already a smaller node, so pass it on.
            node = node.smaller
          else
            # There is no smaller node yet, so we create a new one as a
            # smaller child of the current node.
            node.set_link('@smaller',
                          SpaceTreeNode::create(@tree, address, size, node))
            break
          end
        elsif size > node.size
          # The new size is larger than this node.
          if node.larger
            # There is already a larger node, so pass it on.
            node = node.larger
          else
            # There is no larger node yet, so we create a new one as a larger
            # child of the current node.
            node.set_link('@larger',
                          SpaceTreeNode::create(@tree, address, size, node))
            break
          end
        else
          # Same size as current node. Insert new node as equal child at top of
          # equal list.
          new_node = SpaceTreeNode::create(@tree, address, size, node)
          new_node.set_link('@equal', node.equal)

          node.set_link('@equal', new_node)

          break
        end
      end
    end
Add a new node for the given address and size to the tree.
 @param address [Integer] address of the free space
 @param size [Integer] size of the free space