when the program exits, information is provided:
*** glibc detected *** double free or corruption (!prev): 0x09a8fcb8 ***
One object seems to have double freedom. Then I used gdb to debug the coredump file. Below is the result of bt (no more tracks sent):
#0 0x005197a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
Then the result of valgrind shows that the line is deleted by two different .so files (libkmm.so.2.0.0 and libpv.so.2.0.0). Detailed information (some lines are masked):
==28125== Invalid free() / delete / delete[] ==28125== at 0x400588F: operator delete(void*) (vg_replace_malloc.c:387) ==28125== by 0x446548C: std::string::_Rep::_M_destroy(std::allocator<char> const&) (new_allocator.h:97) ==28125== by 0x55FA7E7: __tcf_0 (in /home/alan_tao/vm/test/lib/libkmm.so.2.0.0) ==28125== by 0x55D5A6: exit (in /lib/tls/libc-2.3.4.so) ==28125== by 0x42B10D9: stop_sim() (in /home/alan_tao/vm/test/lib/libcomm.so.2.0.0) ==28125== by 0x807C83A: func_on_exit(int) (in /home/alan_tao/vm/test/bin/engine) ==28125== by 0x55A917: ??? (in /lib/tls/libc-2.3.4.so) ... ==28125== Address 0x4a484d0 is 0 bytes inside a block of size 525 free'd ==28125== at 0x400588F: operator delete(void*) (vg_replace_malloc.c:387) ==28125== by 0x446548C: std::string::_Rep::_M_destroy(std::allocator<char> const&) new_allocator.h:97) ==28125== by 0x650C0B7: __tcf_0 (in /home/alan_tao/vm/test/lib/libpv.so.2.0.0) ==28125== by 0x55D5A6: exit (in /lib/tls/libc-2.3.4.so) ==28125== by 0x42B10D9: stop_sim() (in /home/alan_tao/vm/test/lib/libcomm.so.2.0.0) ==28125== by 0x807C83A: func_on_exit(int) (in /home/alan_tao/vm/test/bin/engine) ==28125== by 0x55A917: ??? (in /lib/tls/libc-2.3.4.so)
...
The result of valgrind shows that one row is deleted twice. But I can not know the correct static. Who has the idea of ββknowing which line is causing the error and how to fix it? Thanks
PS: the program works under Linux 2.6.9. Gcc version is 4.2.2. dll.
New update: Using gdb to display the error lib file, the command "l __tcf_0" shows me the following code:
inline std::vector<const char*>& get_phase_name_vec(){ static std::vector<const char*> phase_name_vec(END_RESP+1, (const char*)NULL); return phase_name_vec; }
This is from the OSCI TLM header file. And the above libraries should include them. It is located in the split "tlm" namespace. Any idea to fix this error?
c ++ segmentation-fault exit-code
user1093353
source share