2014-02-21 37 views
0

我有一個用C++編寫的代碼,它生成一個sharedlib(.so)文件,這個文件反過來在我的RHEL3上運行的應用程序中使用。glibc損壞了RHEL 5中的雙鏈表5

現在我必須遷移到RHEL5。 .so文件的代碼編譯成功,但是當我嘗試將服務啓動時,它顯示** glibc損壞了雙鏈表 **但服務啓動成功。

這是否可以歸因於操作系統作爲相同的代碼爲相同的.so編譯在RHEL3工作正常。

此外,如果我將在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) 
+0

使用[valgrind](http://valgrind.org/)來調試您的內存泄漏。 –

+0

這個錯誤很可能出現在你的代碼中......「glibc損壞了雙鏈表」消息有助於找到它。 –

回答

1

在大多數情況下,這意味着某些內存被釋放兩次。 所以這個錯誤很可能在你的代碼中。

嘗試在新系統上重新編譯您的庫並使用valgrind找出導致問題的原因。

相關問題