/* richardm@lukd02[dev-lon]$ g++ --version g++ (GCC) 4.3.2 Copyright (C) 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. richardm@lukd02[dev-lon]$ uname -a Linux lukd02 2.6.18-92.el5xen #1 SMP Tue Apr 29 13:31:30 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux THIS BUILD COMMAND WORKS OK g++ boost-interprocess-bug-report.cpp -pthread -m64 -I/home/richardm/tools/boost/boost-1.43.0/include -O2 -L/home/richardm/tools/boost/boost-1.43.0/lib -Bstatic -lboost_thread -o d.out -Wl,-rpath /home/richardm/tools/boost/boost-1.43.0/lib THIS BUILD COMMAND BUILDS A EXE THAT SEGVS g++ boost-interprocess-bug-report.cpp -DNDEBUG -pthread -m64 -I/home/richardm/tools/boost/boost-1.43.0/include -O2 -L/home/richardm/tools/boost/boost-1.43.0/lib -Bstatic -lboost_thread -o d.out -Wl,-rpath /home/richardm/tools/boost/boost-1.43.0/lib my boost install is a standard 1.43.0 */ ////////////////////////////////////////////////////////////////////////////////////////////////// #include #include #include #include // using namespace boost::interprocess; typedef boost::interprocess::allocator MyAllocator; typedef boost::interprocess::vector MyVector; int main(int argc, char *argv[]) { try{ std::cout << "calling constructor.." << std::endl; boost::interprocess::managed_mapped_file segment(boost::interprocess::open_or_create, "MyMemMapFile", 65536); std::cout << "mapped." << std::endl; MyAllocator alloc_inst (segment.get_segment_manager()); // the presence of this line causes the above managed_mapped_file constructor to segv MyVector *myvector = segment.find_or_construct("MyVector")(alloc_inst); std::cout << "vector constructed." << std::endl; } catch(std::exception & x ) { std::cout << "exception:" << x.what() << std::endl; } return 0; };