Opened 7 years ago
#11695 new Bugs
Crash if boost managed_shared_memory is used on Windows
Reported by: | Owned by: | Ion Gaztañaga | |
---|---|---|---|
Milestone: | To Be Determined | Component: | interprocess |
Version: | Boost 1.60.0 | Severity: | Showstopper |
Keywords: | managed_shared_memory | Cc: | akpandey@… |
Description
The process executing below sample code crashes if two or more instances are executed simultaneously. If two instances are started at a gap of 1 second, then there is no crash.
#include <boost/interprocess/managed_shared_memory.hpp> #include <boost/interprocess/allocators/allocator.hpp> #include <boost/interprocess/containers/string.hpp> #include <string> #include <iostream> #define RESERVED_BUFFER_SIZE_WRITE (8 * 0x0100000) namespace bip = boost::interprocess; //Typedefs of allocators and containers typedef bip::allocator<char, bip::managed_shared_memory::segment_manager> char_allocator; typedef bip::basic_string<char, std::char_traits<char>, char_allocator> char_string; int main() { bip::managed_shared_memory m_sharedMemUsage(bip::open_or_create, "MyBookkeeper", 2 * RESERVED_BUFFER_SIZE_WRITE); char_allocator alloc_inst3(m_sharedMemUsage.get_segment_manager()); for (int count = 0; count < 100000; ++count) { char_string key_obect("AAAAAAAAAAAAAAAAAAAAAAA", alloc_inst3); } }
Note:
See TracTickets
for help on using tickets.