Any chance valgrind can help? Sounds like unitialized read for me.
Indeed Valgrind shows an uninitialized value issue but the heavy use of templates makes the output quite daunting. I've attached it nonetheless in case somebody wants to help at pinpointing the problem. ==16105== Conditional jump or move depends on uninitialised value(s) ==16105== at 0x4672A0: boost::interprocess::offset_ptr<boost::intrusive::compact_rbtree_node<boost::interprocess::offset_ptr<void, long, unsigned long, 0ul> >, long, unsigned long, 0ul> boost::intrusive::detail::tree_algorithms<boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, true> >::lower_bound<int, boost::intrusive::detail::key_nodeptr_comp<boost::container::containers_detail::rbtree<int, std::pair<int const, double>, boost::container::containers_detail::select1st<std::pair<int const, double> >, std::less<int>, boost::interprocess::allocator<std::pair<int, double>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, 0ul>, boost::interprocess::iset_index> >
::key_node_compare<boost::container::containers_detail::value_compare_impl<int, std::pair<int const, double>, std::less<int>, boost::container::containers_detail::select1st<std::pair<int const, double> > > >, boost::intrusive::rbtree_impl<boost::intrusive::setopt<boost::intrusive::detail::base_hook_traits<boost::container::containers_detail::rbtree_node<std::pair<int, double>, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul> >, boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, true>, (boost::intrusive::link_mode_type)0, boost::intrusive::default_tag, 3>, boost::container::containers_detail::node_compare<boost::container::containers_detail::value_compare_impl<int, std::pair<int const, double>, std::less<int>, boost::container::containers_detail::select1st<std::pair<int const, double> > >, boost::container::containers_detail::rbtree_node<std::pair<int, double>, boost::interprocess::offset_ptr<void, long, unsig ned long, 0ul> > >, unsigned long, true> > > >(boost::interprocess::offset_ptr<boost::intrusive::compact_rbtree_node<boost::interprocess::offset_ptr<void, long, unsigned long, 0ul> > const, long, unsigned long, 0ul>, int const&, boost::intrusive::detail::key_nodeptr_comp<boost::container::containers_detail::rbtree<int, std::pair<int const, double>, boost::container::containers_detail::select1st<std::pair<int const, double> >, std::less<int>, boost::interprocess::allocator<std::pair<int, double>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, 0ul>, boost::interprocess::iset_index> > >::key_node_compare<boost::container::containers_detail::value_compare_impl<int, std::pair<int const, double>, std::less<int>, boost::container::containers_detail::select1st<std::pair<int const, double> > > >, boost::intrusive::rbtree_impl<boost::intrusive::setopt<boo st::intrusive::detail::base_hook_traits<boost::container::containers_detail::rbtree_node<std::pair<int, double>, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul> >, boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, true>, (boost::intrusive::link_mode_type)0, boost::intrusive::default_tag, 3>, boost::container::containers_detail::node_compare<boost::container::containers_detail::value_compare_impl<int, std::pair<int const, double>, std::less<int>, boost::container::containers_detail::select1st<std::pair<int const, double> > >, boost::container::containers_detail::rbtree_node<std::pair<int, double>, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul> > >, unsigned long, true> > >) (tree_algorithms.hpp:839) ==16105== by 0x465661: boost::interprocess::offset_ptr<boost::intrusive::compact_rbtree_node<boost::interprocess::offset_ptr<void, long, unsigned long, 0ul> >, long, unsigned long, 0ul> boost::intrusive::detail::tree_algorithms<boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, true> >::find<int, boost::intrusive::detail::key_nodeptr_comp<boost::container::containers_detail::rbtree<int, std::pair<int const, double>, boost::container::containers_detail::select1st<std::pair<int const, double> >, std::less<int>, boost::interprocess::allocator<std::pair<int, double>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, 0ul>, boost::interprocess::iset_index> > ::key_node_compare<boost::container::containers_detail::value_compare_impl<int, std::pair<int const, double>, std::less<int>, boost::container::containers_detail::select1st<std::pair<int const, double> > > >, boost::intrusive::rbtree_impl<boost::intrusive::setopt<boost::intrusive::detail::base_hook_traits<boost::container::containers_detail::rbtree_node<std::pair<int, double>, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul> >, boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, true>, (boost::intrusive::link_mode_type)0, boost::intrusive::default_tag, 3>, boost::container::containers_detail::node_compare<boost::container::containers_detail::value_compare_impl<int, std::pair<int const, double>, std::less<int>, boost::container::containers_detail::select1st<std::pair<int const, double> > >, boost::container::containers_detail::rbtree_node<std::pair<int, double>, boost::interprocess::offset_ptr<void, long, unsig ned long, 0ul> > >, unsigned long, true> > > >(boost::interprocess::offset_ptr<boost::intrusive::compact_rbtree_node<boost::interprocess::offset_ptr<void, long, unsigned long, 0ul> > const, long, unsigned long, 0ul>, int const&, boost::intrusive::detail::key_nodeptr_comp<boost::container::containers_detail::rbtree<int, std::pair<int const, double>, boost::container::containers_detail::select1st<std::pair<int const, double> >, std::less<int>, boost::interprocess::allocator<std::pair<int, double>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, 0ul>, boost::interprocess::iset_index> > >::key_node_compare<boost::container::containers_detail::value_compare_impl<int, std::pair<int const, double>, std::less<int>, boost::container::containers_detail::select1st<std::pair<int const, double> > > >, boost::intrusive::rbtree_impl<boost::intrusive::setopt<boo st::intrusive::detail::base_hook_traits<boost::container::containers_detail::rbtree_node<std::pair<int, double>, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul> >, boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, true>, (boost::intrusive::link_mode_type)0, boost::intrusive::default_tag, 3>, boost::container::containers_detail::node_compare<boost::container::containers_detail::value_compare_impl<int, std::pair<int const, double>, std::less<int>, boost::container::containers_detail::select1st<std::pair<int const, double> > >, boost::container::containers_detail::rbtree_node<std::pair<int, double>, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul> > >, unsigned long, true> > >) (tree_algorithms.hpp:758) ==16105== by 0x4644CB: boost::interprocess::offset_ptr<boost::intrusive::compact_rbtree_node<boost::interprocess::offset_ptr<void, long, unsigned long, 0ul> >, long, unsigned long, 0ul> boost::intrusive::rbtree_algorithms<boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, true> >::find<int, boost::intrusive::detail::key_nodeptr_comp<boost::container::containers_detail::rbtree<int, std::pair<int const, double>, boost::container::containers_detail::select1st<std::pair<int const, double> >, std::less<int>, boost::interprocess::allocator<std::pair<int, double>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, 0ul>, boost::interprocess::iset_index> > ::key_node_compare<boost::container::containers_detail::value_compare_impl<int, std::pair<int const, double>, std::less<int>, boost::container::containers_detail::select1st<std::pair<int const, double> > > >, boost::intrusive::rbtree_impl<boost::intrusive::setopt<boost::intrusive::detail::base_hook_traits<boost::container::containers_detail::rbtree_node<std::pair<int, double>, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul> >, boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, true>, (boost::intrusive::link_mode_type)0, boost::intrusive::default_tag, 3>, boost::container::containers_detail::node_compare<boost::container::containers_detail::value_compare_impl<int, std::pair<int const, double>, std::less<int>, boost::container::containers_detail::select1st<std::pair<int const, double> > >, boost::container::containers_detail::rbtree_node<std::pair<int, double>, boost::interprocess::offset_ptr<void, long, unsig ned long, 0ul> > >, unsigned long, true> > > >(boost::interprocess::offset_ptr<boost::intrusive::compact_rbtree_node<boost::interprocess::offset_ptr<void, long, unsigned long, 0ul> > const, long, unsigned long, 0ul>, int const&, boost::intrusive::detail::key_nodeptr_comp<boost::container::containers_detail::rbtree<int, std::pair<int const, double>, boost::container::containers_detail::select1st<std::pair<int const, double> >, std::less<int>, boost::interprocess::allocator<std::pair<int, double>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, 0ul>, boost::interprocess::iset_index> > >::key_node_compare<boost::container::containers_detail::value_compare_impl<int, std::pair<int const, double>, std::less<int>, boost::container::containers_detail::select1st<std::pair<int const, double> > > >, boost::intrusive::rbtree_impl<boost::intrusive::setopt<boo st::intrusive::detail::base_hook_traits<boost::container::containers_detail::rbtree_node<std::pair<int, double>, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul> >, boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, true>, (boost::intrusive::link_mode_type)0, boost::intrusive::default_tag, 3>, boost::container::containers_detail::node_compare<boost::container::containers_detail::value_compare_impl<int, std::pair<int const, double>, std::less<int>, boost::container::containers_detail::select1st<std::pair<int const, double> > >, boost::container::containers_detail::rbtree_node<std::pair<int, double>, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul> > >, unsigned long, true> > >) (rbtree_algorithms.hpp:502) ==16105== by 0x4629C6: boost::intrusive::tree_iterator<boost::intrusive::rbtree_impl<boost::intrusive::setopt<boost::intrusive::detail::base_hook_traits<boost::container::containers_detail::rbtree_node<std::pair<int, double>, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul> , boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, true>, (boost::intrusive::link_mode_type)0, boost::intrusive::default_tag, 3>, boost::container::containers_detail::node_compare<boost::container::containers_detail::value_compare_impl<int, std::pair<int const, double>, std::less<int>, boost::container::containers_detail::select1st<std::pair<int const, double> > >, boost::container::containers_detail::rbtree_node<std::pair<int, double>, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul> > >, unsigned long, true> >, false> boost::intrusive::rbtree_impl<boost::intrusive::setopt<boost::intrusive::detail::base_hook_traits<boost::container::containers_detail::rbtree_node<std::pair<int, double>, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul> , boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, true>, (boost::intrusive::link_mode_type)0, boost::intrusive::default_tag, 3>, boost::container::containers_detail::node_compare<boost::container::containers_detail::value_compare_impl<int, std::pair<int const, double>, std::less<int>, boost::container::containers_detail::select1st<std::pair<int const, double> > >, boost::container::containers_detail::rbtree_node<std::pair<int, double>, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul> > >, unsigned long, true> >::find<int, boost::container::containers_detail::rbtree<int, std::pair<int const, double>, boost::container::containers_detail::select1st<std::pair<int const, double> >, std::less<int>, boost::interprocess::allocator<std::pair<int, double>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, 0ul>, boost::interprocess::iset_index> > ::key_node_compare<boost::container::containers_detail::value_compare_impl<int, std::pair<int const, double>, std::less<int>, boost::container::containers_detail::select1st<std::pair<int const, double> > > > >(int const&, boost::container::containers_detail::rbtree<int, std::pair<int const, double>, boost::container::containers_detail::select1st<std::pair<int const, double> >, std::less<int>, boost::interprocess::allocator<std::pair<int, double>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, 0ul>, boost::interprocess::iset_index> > >::key_node_compare<boost::container::containers_detail::value_compare_impl<int, std::pair<int const, double>, std::less<int>, boost::container::containers_detail::select1st<std::pair<int const, double> > > >) (rbtree.hpp:1153) ==16105== by 0x46130D: boost::container::containers_detail::rbtree<int, std::pair<int const, double>, boost::container::containers_detail::select1st<std::pair<int const, double> >, std::less<int>, boost::interprocess::allocator<std::pair<int, double>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, 0ul>, boost::interprocess::iset_index> > >::find(int const&) (tree.hpp:844) ==16105== by 0x460937: boost::container::map<int, double, std::less<int>, boost::interprocess::allocator<std::pair<int, double>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, 0ul>, boost::interprocess::iset_index> > >::find(int const&) (map.hpp:612) ==16105== by 0x45E53A: main (main.cpp:42)