我有一个使用 Qt 4.8 的 C++ 程序。在 64 位 Ubuntu 11.10 上使用 gcc 4.6.1 编译时运行良好。但是当在 32 位 SUSE Enterprise Linux (SLES) 11 sp 1 和 gcc 4.3 上编译时,每次程序退出时,它都会崩溃
*** glibc detected *** /opt/myprogram: corrupted double-linked list: 0x0821dfb0 ***
======= Backtrace: =========
/lib/libc.so.6(+0x6d3d4)[0xb6fd93d4]
/lib/libc.so.6(+0x6d929)[0xb6fd9929]
/lib/libc.so.6(+0x6ec7f)[0xb6fdac7f]
/lib/libc.so.6(cfree+0x6d)[0xb6fddcfd]
/usr/lib/libstdc++.so.6(_ZdlPv+0x21)[0xb71bd291]
/opt/ncrue/lib/libQtCore.so.4(_ZN8QMapData16continueFreeDataEi+0x59)[0xb72bdf49]
/opt/ncrue/lib/libQtCore.so.4(+0xc09e3)[0xb72d39e3]
/opt/ncrue/lib/libQtCore.so.4(+0xb0434)[0xb72c3434]
/opt/ncrue/lib/libQtCore.so.4(+0xc17df)[0xb72d47df]
/lib/libc.so.6(+0x2dbe1)[0xb6f99be1]
/lib/libc.so.6(+0x2dc3f)[0xb6f99c3f]
/lib/libc.so.6(__libc_start_main+0xed)[0xb6f82bed]
/opt/myprogram[0x80554c1]
valgrind 提供了一些关于对已释放内存块的引用的不太有用的信息,但这些都是在结束后发生的事情main()
。
我完全不知道如何解决这个问题。有谁知道发生了什么或如何解决?
ETA:这是要求的 valgrind 输出。
==24079== Invalid read of size 4
==24079== at 0x7CE03B2: __tcf_0 (qatomic_i386.h:132)
==24079== by 0x482EBE0: __run_exit_handlers (in /lib/libc-2.11.1.so)
==24079== by 0x482EC3E: exit (in /lib/libc-2.11.1.so)
==24079== by 0x4817BEC: (below main) (in /lib/libc-2.11.1.so)
==24079== Address 0x6a0aec0 is 0 bytes inside a block of size 42 free'd
==24079== at 0x4028FE1: free (vg_replace_malloc.c:446)
==24079== by 0x444107C: qFree(void*) (in /opt/ncrue/lib/libQtCore.so.4.8.0)
==24079== by 0x449923F: QString::free(QString::Data*) (in /opt/ncrue/lib/libQtCore.so.4.8.0)
==24079== by 0x5F165E5: ???
==24079== by 0x482EF87: __cxa_finalize (in /lib/libc-2.11.1.so)
==24079== by 0x5E2BBA3: ???
==24079== by 0x5F4B47F: ???
==24079== by 0x4014356: _dl_close_worker (in /lib/ld-2.11.1.so)
==24079== by 0x4014CE6: _dl_close (in /lib/ld-2.11.1.so)
==24079== by 0x549ECF3: dlclose_doit (in /lib/libdl-2.11.1.so)
==24079== by 0x400F125: _dl_catch_error (in /lib/ld-2.11.1.so)
==24079== by 0x549F11B: _dlerror_run (in /lib/libdl-2.11.1.so)
==24079==
==24079== Invalid read of size 4
==24079== at 0x68693E2: __tcf_0 (qatomic_i386.h:132)
==24079== by 0x482EBE0: __run_exit_handlers (in /lib/libc-2.11.1.so)
==24079== by 0x482EC3E: exit (in /lib/libc-2.11.1.so)
==24079== by 0x4817BEC: (below main) (in /lib/libc-2.11.1.so)
==24079== Address 0x6a0aec0 is 0 bytes inside a block of size 42 free'd
==24079== at 0x4028FE1: free (vg_replace_malloc.c:446)
==24079== by 0x444107C: qFree(void*) (in /opt/ncrue/lib/libQtCore.so.4.8.0)
==24079== by 0x449923F: QString::free(QString::Data*) (in /opt/ncrue/lib/libQtCore.so.4.8.0)
==24079== by 0x5F165E5: ???
==24079== by 0x482EF87: __cxa_finalize (in /lib/libc-2.11.1.so)
==24079== by 0x5E2BBA3: ???
==24079== by 0x5F4B47F: ???
==24079== by 0x4014356: _dl_close_worker (in /lib/ld-2.11.1.so)
==24079== by 0x4014CE6: _dl_close (in /lib/ld-2.11.1.so)
==24079== by 0x549ECF3: dlclose_doit (in /lib/libdl-2.11.1.so)
==24079== by 0x400F125: _dl_catch_error (in /lib/ld-2.11.1.so)
==24079== by 0x549F11B: _dlerror_run (in /lib/libdl-2.11.1.so)
==24079==
==24079== Invalid read of size 4
==24079== at 0x681DB72: __tcf_0 (qatomic_i386.h:132)
==24079== by 0x482EBE0: __run_exit_handlers (in /lib/libc-2.11.1.so)
==24079== by 0x482EC3E: exit (in /lib/libc-2.11.1.so)
==24079== by 0x4817BEC: (below main) (in /lib/libc-2.11.1.so)
==24079== Address 0x6a0aec0 is 0 bytes inside a block of size 42 free'd
==24079== at 0x4028FE1: free (vg_replace_malloc.c:446)
==24079== by 0x444107C: qFree(void*) (in /opt/ncrue/lib/libQtCore.so.4.8.0)
==24079== by 0x449923F: QString::free(QString::Data*) (in /opt/ncrue/lib/libQtCore.so.4.8.0)
==24079== by 0x5F165E5: ???
==24079== by 0x482EF87: __cxa_finalize (in /lib/libc-2.11.1.so)
==24079== by 0x5E2BBA3: ???
==24079== by 0x5F4B47F: ???
==24079== by 0x4014356: _dl_close_worker (in /lib/ld-2.11.1.so)
==24079== by 0x4014CE6: _dl_close (in /lib/ld-2.11.1.so)
==24079== by 0x549ECF3: dlclose_doit (in /lib/libdl-2.11.1.so)
==24079== by 0x400F125: _dl_catch_error (in /lib/ld-2.11.1.so)
==24079== by 0x549F11B: _dlerror_run (in /lib/libdl-2.11.1.so)
==24079==
==24079== Invalid read of size 4
==24079== at 0x8055F82: __tcf_0 (qatomic_i386.h:132)
==24079== by 0x482EBE0: __run_exit_handlers (in /lib/libc-2.11.1.so)
==24079== by 0x482EC3E: exit (in /lib/libc-2.11.1.so)
==24079== by 0x4817BEC: (below main) (in /lib/libc-2.11.1.so)
==24079== Address 0x6a0aec0 is 0 bytes inside a block of size 42 free'd
==24079== at 0x4028FE1: free (vg_replace_malloc.c:446)
==24079== by 0x444107C: qFree(void*) (in /opt/ncrue/lib/libQtCore.so.4.8.0)
==24079== by 0x449923F: QString::free(QString::Data*) (in /opt/ncrue/lib/libQtCore.so.4.8.0)
==24079== by 0x5F165E5: ???
==24079== by 0x482EF87: __cxa_finalize (in /lib/libc-2.11.1.so)
==24079== by 0x5E2BBA3: ???
==24079== by 0x5F4B47F: ???
==24079== by 0x4014356: _dl_close_worker (in /lib/ld-2.11.1.so)
==24079== by 0x4014CE6: _dl_close (in /lib/ld-2.11.1.so)
==24079== by 0x549ECF3: dlclose_doit (in /lib/libdl-2.11.1.so)
==24079== by 0x400F125: _dl_catch_error (in /lib/ld-2.11.1.so)
==24079== by 0x549F11B: _dlerror_run (in /lib/libdl-2.11.1.so)
==24079==
==24079== Invalid read of size 4
==24079== at 0x4188F32: __tcf_0 (qatomic_i386.h:132)
==24079== by 0x482EF87: __cxa_finalize (in /lib/libc-2.11.1.so)
==24079== by 0x40787C3: ??? (in /opt/ncrue/lib/libDataFileAccess.so.1.2.0)
==24079== by 0x419802F: ??? (in /opt/ncrue/lib/libDataFileAccess.so.1.2.0)
==24079== by 0x400FB3A: _dl_fini (in /lib/ld-2.11.1.so)
==24079== by 0x482EBE0: __run_exit_handlers (in /lib/libc-2.11.1.so)
==24079== by 0x482EC3E: exit (in /lib/libc-2.11.1.so)
==24079== by 0x4817BEC: (below main) (in /lib/libc-2.11.1.so)
==24079== Address 0x6a0aec0 is 0 bytes inside a block of size 42 free'd
==24079== at 0x4028FE1: free (vg_replace_malloc.c:446)
==24079== by 0x444107C: qFree(void*) (in /opt/ncrue/lib/libQtCore.so.4.8.0)
==24079== by 0x449923F: QString::free(QString::Data*) (in /opt/ncrue/lib/libQtCore.so.4.8.0)
==24079== by 0x5F165E5: ???
==24079== by 0x482EF87: __cxa_finalize (in /lib/libc-2.11.1.so)
==24079== by 0x5E2BBA3: ???
==24079== by 0x5F4B47F: ???
==24079== by 0x4014356: _dl_close_worker (in /lib/ld-2.11.1.so)
==24079== by 0x4014CE6: _dl_close (in /lib/ld-2.11.1.so)
==24079== by 0x549ECF3: dlclose_doit (in /lib/libdl-2.11.1.so)
==24079== by 0x400F125: _dl_catch_error (in /lib/ld-2.11.1.so)
==24079== by 0x549F11B: _dlerror_run (in /lib/libdl-2.11.1.so)