free(): double free detected in tcache 2

Johan j at j.nl
Fri Aug 13 11:01:00 UTC 2021


On Friday, 13 August 2021 at 05:58:34 UTC, workman wrote:
> link with -flto=full from linux get this error:
>
> ```sh
> free(): double free detected in tcache 2
>
> Program received signal SIGABRT, Aborted.
> __GI_raise (sig=sig at entry=6) at 
> ../sysdeps/unix/sysv/linux/raise.c:50
> 50	../sysdeps/unix/sysv/linux/raise.c: No such file or 
> directory.
> (gdb) bt
> #0  __GI_raise (sig=sig at entry=6) at 
> ../sysdeps/unix/sysv/linux/raise.c:50
> #1  0x00007ffff7ca5537 in __GI_abort () at abort.c:79
> #2  0x00007ffff7cfe768 in __libc_message 
> (action=action at entry=do_abort, fmt=fmt at entry=0x7ffff7e0ce2d 
> "%s\n") at ../sysdeps/posix/libc_fatal.c:155
> #3  0x00007ffff7d05a5a in malloc_printerr 
> (str=str at entry=0x7ffff7e0f170 "free(): double free detected in 
> tcache 2") at malloc.c:5347
> #4  0x00007ffff7d07055 in _int_free (av=0x7ffff7e3eb80 
> <main_arena>, p=0x54a360, have_lock=1) at malloc.c:4201
> #5  0x00007ffff7d09995 in _int_realloc 
> (av=av at entry=0x7ffff7e3eb80 <main_arena>, 
> oldp=oldp at entry=0x54a360, oldsize=oldsize at entry=32, 
> nb=88736032) at malloc.c:4618
> #6  0x00007ffff7d0aab6 in __GI___libc_realloc (oldmem=0x54a370, 
> bytes=88736016) at malloc.c:3226
> #7  0x000000000046f604 in 
> core.internal.container.common.xrealloc(void*, ulong) ()
> #8  0x000000000046e3dd in 
> core.internal.container.array.Array!(void[]).Array.length(ulong) ()
> #9  0x000000000046f4f6 in 
> core.internal.container.array.Array!(void[]).Array.insertBack!().insertBack(void[]) ()
> #10 0x00000000004b078f in _d_dso_registry ()
> #11 0x00000000004b3d72 in ldc.register_dso ()
> #12 0x00007ffff7fe2373 in _dl_fini () at dl-fini.c:138
> #13 0x00007ffff7cbe4d7 in __run_exit_handlers (status=0, 
> listp=0x7ffff7e3e718 <__exit_funcs>, 
> run_list_atexit=run_list_atexit at entry=true, 
> run_dtors=run_dtors at entry=true) at exit.c:108
> #14 0x00007ffff7cbe67a in __GI_exit (status=<optimized out>) at 
> exit.c:139
> #15 0x00007ffff7ca6d11 in __libc_start_main (main=0x4df1e0 
> <main>, argc=2, argv=0x7fffffffdec8, init=<optimized out>, 
> fini=<optimized out>, rtld_fini=<optimized out>, 
> stack_end=0x7fffffffdeb8) at ../csu/libc-start.c:342
> #16 0x00000000002f63fa in _start ()
> ```

Can you check how often _d_dso_registry is called after 
__run_exit_handlers ?



More information about the digitalmars-d-ldc mailing list