in reply to Re: What is "double free or corruption"?
in thread What is "double free or corruption"?

You can pass an -o tracefile option to strace and tail -f that in another window. Much less confusing.

And in this case, I don't think strace (which traces system calls) can help much. ltrace can be more useful -- it traces library calls too.

Replies are listed 'Best First'.
Re^3: What is "double free or corruption"?
by dmd (Initiate) on Sep 16, 2004 at 14:10 UTC
    Does this reveal anything useful?
    [root@eco ~]# ltrace perl -MCPAN -e shell __libc_start_main(0x8049278, 4, 0xbfffe644, 0x804a55c, 0x804a5b0 <unfi +nished ...> signal(8, 0x1) += NULL { lots of stuff} cpan shell -- CPAN exploration and modules installation (v1.7601) ReadLine support enabled cpan> q <... perl_run resumed> ) += 0 perl_destruct(0x804bc10, 0x80493b8, 4, 0xbfffe644, 0Lockfile removed. *** glibc detected *** double free or corruption: 0x08610b28 *** <unfinished ...> --- SIGABRT (Aborted) --- +++ killed by SIGABRT +++ [root@eco ~]#
      Looks like it's happening, surprise, during global destruction. My practical knowledge ends here :) But generally I suppose what you want is to mark all your variables so that when you trip the warning you know who it is who's freeing 0x08610b28 (and what 0x08610b28 is). (Obvisouly it can be a different value next time round!)

      I know GTK has a switch to make warnings fatal, so that if you run a process in gdb you are dropped into the debugger and have a stack trace at your disposal. Probably glibc has something similar? You'll likely need the debug version of your libraries for this.