Thread: what mean malloc_consolidate

  1. #1
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300

    what mean malloc_consolidate

    This is the first time I've seen this:

    (from gdb)
    Code:
    Program received signal SIGSEGV, Segmentation fault.
    [Switching to Thread -1208293696 (LWP 3149)]
    0x479850ac in malloc_consolidate () from /lib/libc.so.6
    what should I think about? It's a "only happens sometimes" problem.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Well, it's just some function called within 'malloc'. My guess would be that you're program is thrashing an internal data structure, causing a seg fault when 'malloc_consolidate' is executed. Worse kind of bug...
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    38,169
    Use valgrind perhaps?

    Or
    gcc prog.c -lefence
    and get a segfault as soon as you trash memory, and not sometime later when malloc finds out.

    Run the program in the debugger, then just back-track up the stack to your line of code writing where it shouldn't.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed