add a ref_count to the memory segments...this way I could increase references and only insert the memory segment in the tree again if the ref_count is one.