c++ - malloc 或我的错误?

标签 c++ c gcc

这是我的错误还是 malloc 本身的错误/断言失败?

alloc.c:2451: sYSMALLOc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size)

= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 * (sizeof(size_t))) - 1)) & ~((2 * (sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) && ((unsigned long)old_end & pagemask) == 0)' failed.

  • libstdc++6:amd64 4.7.2-2ubuntu1
  • 海湾合作委员会 4.7.2
  • ubuntu 12.10/64 位

最佳答案

最可能的解释是您的程序中存在内存错误(写入释放的内存、缓冲区溢出等)。 malloc() 中出现彻底错误的可能性要小得多。

关于c++ - malloc 或我的错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13792782/

相关文章:

c++ - fork() 和 waitpid() 不等待 child

谁能给我这个程序的干输出?

c - HTK编译错误: make[1]: Nothing to be done for 'all'

gcc - 如何使用内置的 rpath 构建和安装 gcc?

c++ - 我什么时候可以自信地使用 -O3 编译程序?

c++ - boost::program_options:如何忽略未知参数?

c++ - 哪个 C++ STL 容器提供 `extract_max()` 、 `find(element_value)` 和 `modify(element)` 功能?

c++ - 创建类对象后对 vtable 的 undefined reference

c - sem_wait 在我的程序中被忽略

c - 对我的简单二十一点程序的建议/改进