简体   繁体   English

boost:interprocess中的异常,共享内存对象删除

[英]exception in boost:interprocess, shared memory object deletion

there is a simple piece of code which I moved to main function of sample app to avoid the affecting of any other application parts: 我将一小段代码移到示例应用程序的主要功能,以避免影响其他任何应用程序部分:

    namespace bi = boost:interprocess;

    bi::shared_memory_object::remove("shm");
    bi::named_mutex::remove("mtx");
    bi::named_condition::remove("cnd");

just first line raise an exception in internal boost interprocess code: in windows_intermodule_singleton.hpp, 118 (v 1.60.0) bolded line is where it's happening. 仅第一行在内部boost进程间代码中引发了异常:在windows_intermodule_singleton.hpp中,118(v 1.60.0)粗体行是发生这种情况的地方。 Win64, VC v19, Windows 10 Win64,VC v19,Windows 10

     ...
     caster.addr = m;
     BOOST_ASSERT((caster.addr_uint64 & boost::uint64_t(3)) == 0);
     max_count = boost::uint32_t(caster.addr_uint64 >> 32);
     **initial_count = boost::uint32_t(caster.addr_uint64);**
     initial_count = initial_count/4;
     //Make sure top two bits are zero
     BOOST_ASSERT((max_count & boost::uint32_t(0xC0000000)) == 0);
     //Set quasi-top bit
     max_count |= boost::uint32_t(0x40000000);
     ...

ANy idea why this happens? 知道为什么会这样吗? can this be related with x64 memory model? 这可以与x64内存模型相关吗?

这不是一个例外,我不注意,使用所有/ RTC编译器设置进行编译,并且该位置看起来像潜在的数据丢失(?)8字节至4。windbg报告:_RTC_Check_8_to_4

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM