the memory of top_n.back().key and top_n.back().value is stack space from top_n.back().ref, if pop_heap and pop_back, the ref stack address is changed, so key and top_n.back().key and top_n.back().value is invaild.
the code occur sorted_searched, see also patch from attachment