From: "Steve Graegert" <graegerts@gmail.com>
To: linux-c-programming@vger.kernel.org
Subject: Re: "double free or corruption" - how to solve this?
Date: Sat, 13 May 2006 00:18:27 +0200 [thread overview]
Message-ID: <6a00c8d50605121518v4a01a5dejee034267ead87358@mail.gmail.com> (raw)
In-Reply-To: <1DC8E51669ADE94C85B69D0E5EAEB746629B8E@manchester.maxolution.local>
On 5/12/06, Jedenastik, Günther <guenther.jedenastik@maxolution.at> wrote:
>
> >Hello Shriramana,
>
>
> >On Fri, 12 May 2006 13:41:12 +0530 "Shriramana Sharma" <samjnaa@gmail.com> >wrote:
>
> >> One of my programs, which was working quite well till now, suddenly
> >> gives me the error:
> >>
> >> *** glibc detected *** double free or corruption (top): 0x0808a338 ***
> >> Aborted
> >>
> >> It is a pure C program compiled with GCC 4.02 -- I do not understand
> >> why it does not work suddenly. Please tell me what the above error can
> >> be.
>
> >Would be nice to run it from gdb, in order to get the backtrace when it
> >crashes. This should help you understand where and why :).
>
>
> >Regards,
>
> >--
> >wwp
>
> I have a similar problem, but i don't know how gdb can help with this?
Indeed, in this case gdb is more helpful when operating on core dumps.
> I tried with gdb (btw: I have one process forked (and a few threads) and I think this process creates the problem) but I only get the problem during exit handlers (e.g. SIGINT)
>
gdb has excellent thread debugging facilities; you should have no
problem to switch between threads (see "thread", "info threads" and
"threads apply" commands) and attaching to child processes.
> To get back to my question: how can I trace the problem with gdb, if I have forked processes and threads?
>
> Cause it seems, that glibc only prints the line "*** glibc detected *** double free or corruption" and then continues
By default, the offending program is killed by emitting SIGABRT. A
core dump is generated only if the system is configured to do so (see
ulimit -c and use a reasonably large value). Nevertheless, the
program you want to get a core dump from should intercept SIGABRT and
if you can't set the limits beforehand, you might be able to attach
with gdb, use setrlimit to eliminate the coredump restriction and then
send an ABRT.
> It doesn't send a SIGABORT or something else, so why should gdb "know" something was wrong? And how could I trace back (using "bt") if I have the problem, but don't know where it occures (cause glibc just prints and continues, not?)
No, it actually should not. See if the environment variable
MALLOC_CHECK_ is not to 0 (zero).
> But some internal explanations what "*** glibc detected ***" does (not why it occures, but internally happens if it occures), if anyone knows, would be great
This output is the result of some sanity checks of glibc that can be
configured by setting MALLOC_CHECK_ to values between 1 and 3, while 0
turns checks off, thus not printing a message and not killing the
program.
Bye
\Steve
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2006-05-12 22:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-12 20:40 AW: "double free or corruption" - how to solve this? Jedenastik, Günther
2006-05-12 22:18 ` Steve Graegert [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-05-12 8:11 Shriramana Sharma
2006-05-12 8:19 ` wwp
2006-05-12 8:45 ` Steve Graegert
2006-05-12 21:06 ` Nate Jenkins
2006-05-12 21:35 ` Steve Graegert
2006-05-12 21:46 ` Nate Jenkins
2006-05-12 12:01 ` james-lists
2006-05-12 21:53 ` Steve Graegert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6a00c8d50605121518v4a01a5dejee034267ead87358@mail.gmail.com \
--to=graegerts@gmail.com \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).