Juha said:
Try using this allocator:
http://warp.povusers.org/FSBAllocator/
(You don't need to tell the allocator anything, just use it as the
allocator for your map. You will probably notice a singificant improvement
in allocation performance.)
Hm, this gave me a segfault upon termination of the program.
Interestingly, the segfault seems to have appeared in a
boost::unordered_set for which I hadn't used the FSBAllocator (it didn't
compile when I tried it for a boost::unordered_map, so I didn't try it
for unordered_set). This is the backtrace:
#0 0x00007fd195ea5efd in ?? () from /lib64/libc.so.6
#1 0x00007fd195ea75d8 in ?? () from /lib64/libc.so.6
#2 0x00007fd195eaa96c in free () from /lib64/libc.so.6
#3 0x000000000040e6f8 in deallocate (this=<value optimized out>,
__p=<value optimized out>)
at /home/usr/bin/../lib64/gcc/../../include/c++/4.4/ext/new_allocator.h:95
#4 delete_buckets (this=<value optimized out>, __p=<value optimized out>)
at /usr/include/boost/unordered/detail/buckets.hpp:101
#5 ~hash_buckets (this=<value optimized out>, __p=<value optimized out>)
at /usr/include/boost/unordered/detail/buckets.hpp:135
#6 ~hash_table (this=<value optimized out>, __p=<value optimized out>)
at /usr/include/boost/unordered/detail/fwd.hpp:492
#7 ~hash_unique_table (this=<value optimized out>, __p=<value optimized out>)
at /usr/include/boost/unordered/detail/fwd.hpp:604
#8 boost::unordered_set<std::basic_string<wchar_t, std::char_traits<wchar_t>,
std::allocator<wchar_t> >, boost::hash<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> > >,
std::equal_to<std::basic_string<wchar_t, std::char_traits<wchar_t>,
std::allocator<wchar_t> > >, std::allocator<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> > > >::~unordered_set
(this=<value optimized out>, __p=<value optimized out>)
at /usr/include/boost/unordered/unordered_set.hpp:154
#9 0x00007fd195e68065 in ?? () from /lib64/libc.so.6
#10 0x00007fd195e680b5 in exit () from /lib64/libc.so.6