【发布时间】:2014-02-26 19:01:32
【问题描述】:
我有以下简单的程序:
#include <boost\interprocess\managed_windows_shared_memory.hpp>
#include <boost\interprocess\shared_memory_object.hpp>
using namespace boost::interprocess;
int main ()
{
managed_windows_shared_memory segment(create_only, "MySharedMemory", 655360);
return 0;
}
它崩溃并出现以下异常:
Unhandled exception at 0x00007FF6B7741664 in Server.exe: Stack cookie instrumentation code detected a stack-based buffer overrun.
这只发生在 VC11 中的发布版本。 (VC10 很好)。查看调用堆栈,它发生在 boost\intrusive\rbtree_algorithms.hpp 中的 rebalance_after_insertion() 处。有没有人遇到过类似的问题?
【问题讨论】:
-
堆栈帧已损坏,编译器没有为 boost 对象分配足够的空间。到目前为止,最常见的原因是您链接了错误的版本或错误的 boost 版本。就像你用 VC10 构建的一样。或者调试版本。
-
仔细检查了构建,但它得到了正确的 boost 版本。
-
我有同样的问题,我很确定我使用的是正确版本的 boost。它也只发生在“/O2”优化标志上。
标签: c++ visual-c++ boost visual-studio-2012