c++ - glibc 在 RHEL 5 中损坏了双链表

标签 c++ linux rhel5

我有一个用 C++ 编写的代码,它生成一个 sharedlib(.so) 文件,该文件又用于我在 RHEL3 上运行的应用程序。

现在我必须迁移到 RHEL5。 .so 文件的代码编译成功,但当我尝试启动我的服务时,它显示 **glibc corrupted double linked list** 但服务启动成功。

这是否是由于操作系统的原因,因为在 RHEL3 中编译的相同 .so 的相同代码工作正常。

此外,如果我将在 RHEL3 中编译的 .so 文件复制到 RHEL5 机器上,一切正常。

    This is what i got by running valgrind :
==19845== Invalid read of size 4
==19845==    at 0x453F4EC: std::_Rb_tree<int, std::pair<int const, key>, std::_Select1st<std::pair<int const, key> >, std::less<int>, std::allocator<std::pair<int const, key> > >::_S_right(std::_Rb_tree_node_base*) (in /home/test/examplesofile1.so)
==19845==    by 0x45408AA: std::_Rb_tree<int, std::pair<int const, key>, std::_Select1st<std::pair<int const, key> >, std::less<int>, std::allocator<std::pair<int const, key> > >::_M_erase(std::_Rb_tree_node<std::pair<int const, key> >*) (in /home/test/examplesofile1.so)
==19845==    by 0x4540918: std::_Rb_tree<int, std::pair<int const, key>, std::_Select1st<std::pair<int const, key> >, std::less<int>, std::allocator<std::pair<int const, key> > >::~_Rb_tree() (in /home/test/examplesofile1.so)
==19845==    by 0x4540974: std::map<int, key, std::less<int>, std::allocator<std::pair<int const, key> > >::~map() (in /home/test/examplesofile1.so)
==19845==    by 0x48235FB: (within /home/test/examplesofile2.so)
==19845==    by 0xAA5058: __cxa_finalize (in /lib/libc-2.5.so)
==19845==    by 0x477BC03: (within /home/test/examplesofile2.so)
==19845==    by 0x4A2FDEB: (within /home/test/examplesofile2.so)
==19845==    by 0xA697CD: _dl_fini (in /lib/ld-2.5.so)
==19845==    by 0xAA4DA8: exit (in /lib/libc-2.5.so)
==19845==    by 0x8086F57: vMakeDaemon (commonfunctions.c:438)
==19845==    by 0x8067F9A: Initialize (mngr.c:360)

最佳答案

在大多数情况下,这意味着一些内存被释放了两次。 因此,该错误很可能在您的代码中。

尝试在新系统上重新编译您的库并使用 valgrind 查找导致问题的原因。

关于c++ - glibc 在 RHEL 5 中损坏了双链表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21943433/

相关文章:

python - nginx - 从上游读取响应 header 时上游发送了太大的 header

python - e2fsprogs/e2fslibs 是否有可用的 python bindinds?

linux - Haproxy 绑定(bind)错误

web - RedHat 5 上 WebLogic 站点根目录的默认路径

c++ - 如何在捕获异常后退出程序执行

c++ - 为什么在预期 T 或 T& 时定义重载运算符的任意返回类型是合法的

linux - 托管 Subversion (svn) 存储库的密码过期如何工作?

c++ - 在运行时从 RPN 构造函数可调用对象

c++ - 通过ADC和Arduino从惠斯通电桥产生奇怪的数据

linux - 无法安装或更新 RHEL 5 的 redhat-lsb 软件包