Crash during malloc(), with profiling enabled

Jason Evans jasone at canonware.com
Thu May 8 09:00:45 PDT 2014


On May 8, 2014, at 8:19 AM, Martin Ivanov <martin.ivanov at gmail.com> wrote:
> I have been experimenting recently with jemalloc heap profiling, as way to debug memory leaks, but unfortunately it crashes quite frequently.
> CPU architecture is PPC , below is a typical backtraces I get - looks like the stack is corrupted.
> 
> Program terminated with signal 11, Segmentation fault.
> 
> #0  0x0ffaab14 in je_prof_backtrace (bt=dwarf2_read_address: Corrupted DWARF expression.
> ) at prof.c:398
> ..
> #3  0x0ff7691c in je_choose_arena (arena=<value optimized out>)
>     at src/jemalloc/internal/jemalloc_internal.h:711
> #4  je_tcache_get (create=<value optimized out>) at src/jemalloc/internal/tcache.h:242
> #5  je_arena_malloc (try_tcache=<value optimized out>, zero=<value optimized out>, size=<value optimized out>, 
>     arena=<value optimized out>) at src/jemalloc/internal/arena.h:956
> #6  je_imalloct (arena=<value optimized out>, try_tcache=<value optimized out>, size=<value optimized out>)
>     at src/jemalloc/internal/jemalloc_internal.h:771
> #7  imallocx (arena=<value optimized out>, try_tcache=<value optimized out>, zero=<value optimized out>, 
>     alignment=<value optimized out>, usize=<value optimized out>) at jemalloc.c:1421
> #8  imallocx_prof_sample (usize=dwarf2_read_address: Corrupted DWARF expression.
> ) at jemalloc.c:1436
> ...
> 
> Can anyone tell if this is a known problem and if can be overcome ?

This is probably due to buggy debug info generation in the compiler causing incorrect backtracing.  The only alternatives I’m aware of are to fix the debug info generation, or to make sure everything your application links against preserves frame pointers and use the implementation of prof_backtrace in jemalloc that relies on gcc intrinsics to walk the stack via frame pointers, e.g. configure with —disable-prof-libunwind —disable-prof-libgcc.

Jason


More information about the jemalloc-discuss mailing list