Valgrind detection
Opened this issue · 1 comments
kassane commented
OS: archlinux(glibc)
Arch: x86_64 (zen3)
valgrind - Output
$ valgrind --leak-check=full --show-reachable=yes --error-limit=no --track-origins=yes ./zig-out/bin/example1
==37909== Memcheck, a memory error detector
==37909== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==37909== Using Valgrind-3.22.0 and LibVEX; rerun with -h for copyright info
==37909== Command: ./zig-out/bin/example1
==37909==
Allocating 1024 bytes of memory...
==37909== Conditional jump or move depends on uninitialised value(s)
==37909== at 0x10E650: GC_push_all_eager (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/mark.c:1653)
==37909== by 0x12840F: GC_with_callee_saves_pushed (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/mach_dep.c:343)
==37909== by 0x10FEAC: GC_push_regs_and_stack (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/mark_rts.c:912)
==37909== by 0x10FEAC: GC_push_roots (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/mark_rts.c:989)
==37909== by 0x10C620: push_roots_and_advance (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/mark.c:338)
==37909== by 0x10C620: GC_mark_some (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/mark.c:420)
==37909== by 0x11EE47: GC_stopped_mark (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/alloc.c:892)
==37909== by 0x11EA1A: GC_try_to_collect_inner (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/alloc.c:607)
==37909== by 0x110D63: GC_init (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/misc.c:1441)
==37909== by 0x10A681: main (in /home/kassane/gc_alloc/bdwgc-d/zig-out/bin/example1)
==37909== Uninitialised value was created by a stack allocation
==37909== at 0x12835D: GC_with_callee_saves_pushed (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/mach_dep.c:229)
==37909==
==37909== Conditional jump or move depends on uninitialised value(s)
==37909== at 0x10E64B: GC_push_all_eager (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/mark.c:1653)
==37909== by 0x12840F: GC_with_callee_saves_pushed (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/mach_dep.c:343)
==37909== by 0x10FEAC: GC_push_regs_and_stack (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/mark_rts.c:912)
==37909== by 0x10FEAC: GC_push_roots (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/mark_rts.c:989)
==37909== by 0x10C620: push_roots_and_advance (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/mark.c:338)
==37909== by 0x10C620: GC_mark_some (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/mark.c:420)
==37909== by 0x11EE47: GC_stopped_mark (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/alloc.c:892)
==37909== by 0x11EA1A: GC_try_to_collect_inner (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/alloc.c:607)
==37909== by 0x110D63: GC_init (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/misc.c:1441)
==37909== by 0x10A681: main (in /home/kassane/gc_alloc/bdwgc-d/zig-out/bin/example1)
==37909== Uninitialised value was created by a stack allocation
==37909== at 0x12835D: GC_with_callee_saves_pushed (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/mach_dep.c:229)
==37909==
==37909== Conditional jump or move depends on uninitialised value(s)
==37909== at 0x10CB21: GC_mark_from (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/mark.c:848)
==37909== by 0x10C3E1: GC_mark_some (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/mark.c:0)
==37909== by 0x11EE47: GC_stopped_mark (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/alloc.c:892)
==37909== by 0x11EA1A: GC_try_to_collect_inner (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/alloc.c:607)
==37909== by 0x110D63: GC_init (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/misc.c:1441)
==37909== by 0x10A681: main (in /home/kassane/gc_alloc/bdwgc-d/zig-out/bin/example1)
==37909== Uninitialised value was created by a stack allocation
==37909== at 0x498CD00: __libc_start_main@@GLIBC_2.34 (libc-start.c:242)
==37909==
==37909== Conditional jump or move depends on uninitialised value(s)
==37909== at 0x10CB46: GC_mark_from (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/mark.c:858)
==37909== by 0x10C3E1: GC_mark_some (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/mark.c:0)
==37909== by 0x11EE47: GC_stopped_mark (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/alloc.c:892)
==37909== by 0x11EA1A: GC_try_to_collect_inner (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/alloc.c:607)
==37909== by 0x110D63: GC_init (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/misc.c:1441)
==37909== by 0x10A681: main (in /home/kassane/gc_alloc/bdwgc-d/zig-out/bin/example1)
==37909== Uninitialised value was created by a stack allocation
==37909== at 0x498CC50: (below main) (libc_start_call_main.h:29)
==37909==
==37909== Conditional jump or move depends on uninitialised value(s)
==37909== at 0x10CB26: GC_mark_from (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/mark.c:848)
==37909== by 0x10C3E1: GC_mark_some (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/mark.c:0)
==37909== by 0x11EE47: GC_stopped_mark (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/alloc.c:892)
==37909== by 0x11EA1A: GC_try_to_collect_inner (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/alloc.c:607)
==37909== by 0x110D63: GC_init (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/misc.c:1441)
==37909== by 0x10A681: main (in /home/kassane/gc_alloc/bdwgc-d/zig-out/bin/example1)
==37909== Uninitialised value was created by a stack allocation
==37909== at 0x498CC50: (below main) (libc_start_call_main.h:29)
==37909==
==37909== Conditional jump or move depends on uninitialised value(s)
==37909== at 0x10CB41: GC_mark_from (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/mark.c:858)
==37909== by 0x10C3E1: GC_mark_some (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/mark.c:0)
==37909== by 0x11EE47: GC_stopped_mark (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/alloc.c:892)
==37909== by 0x11EA1A: GC_try_to_collect_inner (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/alloc.c:607)
==37909== by 0x110D63: GC_init (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/misc.c:1441)
==37909== by 0x10A681: main (in /home/kassane/gc_alloc/bdwgc-d/zig-out/bin/example1)
==37909== Uninitialised value was created by a stack allocation
==37909== at 0x1107C0: GC_init (.cache/zig/p/1220dd93f4ff1564d7174a0af33d647c1901fc63c4edb4f1ace710a4af1c2d65174e/misc.c:988)
==37909==
==37909==
==37909== HEAP SUMMARY:
==37909== in use at exit: 0 bytes in 0 blocks
==37909== total heap usage: 8 allocs, 8 frees, 3,096 bytes allocated
==37909==
==37909== All heap blocks were freed -- no leaks are possible
==37909==
==37909== For lists of detected and suppressed errors, rerun with: -s
==37909== ERROR SUMMARY: 118 errors from 6 contexts (suppressed: 0 from 0)
Suppress file (.supp
)
{
<insert_a_suppression_name_here>
Memcheck:Cond
fun:GC_push_all_eager
fun:GC_with_callee_saves_pushed
fun:GC_push_regs_and_stack
fun:GC_push_roots
fun:push_roots_and_advance
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_try_to_collect_inner
fun:GC_init
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Cond
fun:GC_mark_from
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_try_to_collect_inner
fun:GC_init
fun:main
}
kassane commented
example3
- mix druntime with bdwgc-d:
suppression-file generated (Druntime leak)
{
<insert_a_suppression_name_here>
Memcheck:Cond
fun:GC_push_all_eager
fun:GC_push_current_stack
fun:GC_with_callee_saves_pushed
fun:GC_push_regs_and_stack
fun:GC_push_roots
fun:push_roots_and_advance
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_try_to_collect_inner
fun:GC_init
fun:_Dmain
fun:_D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv
}
{
<insert_a_suppression_name_here>
Memcheck:Cond
fun:GC_mark_from
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_try_to_collect_inner
fun:GC_init
fun:_Dmain
fun:_D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv
fun:_d_run_main2
fun:_d_run_main
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Value8
fun:GC_mark_from
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_try_to_collect_inner
fun:GC_init
fun:_Dmain
fun:_D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv
fun:_d_run_main2
fun:_d_run_main
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Cond
fun:GC_header_cache_miss
fun:GC_mark_from
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_try_to_collect_inner
fun:GC_init
fun:_Dmain
fun:_D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv
fun:_d_run_main2
fun:_d_run_main
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Value8
fun:GC_header_cache_miss
fun:GC_mark_from
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_try_to_collect_inner
fun:GC_init
fun:_Dmain
fun:_D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv
fun:_d_run_main2
fun:_d_run_main
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Cond
fun:GC_find_header
fun:GC_add_to_black_list_stack
fun:GC_header_cache_miss
fun:GC_mark_from
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_try_to_collect_inner
fun:GC_init
fun:_Dmain
fun:_D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv
fun:_d_run_main2
fun:_d_run_main
}
{
<insert_a_suppression_name_here>
Memcheck:Value8
fun:GC_find_header
fun:GC_add_to_black_list_stack
fun:GC_header_cache_miss
fun:GC_mark_from
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_try_to_collect_inner
fun:GC_init
fun:_Dmain
fun:_D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv
fun:_d_run_main2
fun:_d_run_main
}
{
<insert_a_suppression_name_here>
Memcheck:Cond
fun:GC_add_to_black_list_stack
fun:GC_header_cache_miss
fun:GC_mark_from
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_try_to_collect_inner
fun:GC_init
fun:_Dmain
fun:_D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv
fun:_d_run_main2
fun:_d_run_main
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Value8
fun:GC_add_to_black_list_stack
fun:GC_header_cache_miss
fun:GC_mark_from
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_try_to_collect_inner
fun:GC_init
fun:_Dmain
fun:_D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv
fun:_d_run_main2
fun:_d_run_main
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Cond
fun:GC_mark_and_push_stack
fun:GC_push_all_eager
fun:GC_push_current_stack
fun:GC_with_callee_saves_pushed
fun:GC_push_regs_and_stack
fun:GC_push_roots
fun:push_roots_and_advance
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_maybe_gc
fun:GC_collect_a_little_inner
fun:GC_start_incremental_collection
}
{
<insert_a_suppression_name_here>
Memcheck:Value8
fun:GC_mark_and_push_stack
fun:GC_push_all_eager
fun:GC_push_current_stack
fun:GC_with_callee_saves_pushed
fun:GC_push_regs_and_stack
fun:GC_push_roots
fun:push_roots_and_advance
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_maybe_gc
fun:GC_collect_a_little_inner
fun:GC_start_incremental_collection
}
{
<insert_a_suppression_name_here>
Memcheck:Cond
fun:GC_find_header
fun:GC_add_to_black_list_stack
fun:GC_mark_and_push_stack
fun:GC_push_all_eager
fun:GC_push_current_stack
fun:GC_with_callee_saves_pushed
fun:GC_push_regs_and_stack
fun:GC_push_roots
fun:push_roots_and_advance
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_maybe_gc
}
{
<insert_a_suppression_name_here>
Memcheck:Value8
fun:GC_find_header
fun:GC_add_to_black_list_stack
fun:GC_mark_and_push_stack
fun:GC_push_all_eager
fun:GC_push_current_stack
fun:GC_with_callee_saves_pushed
fun:GC_push_regs_and_stack
fun:GC_push_roots
fun:push_roots_and_advance
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_maybe_gc
}
{
<insert_a_suppression_name_here>
Memcheck:Cond
fun:GC_add_to_black_list_stack
fun:GC_mark_and_push_stack
fun:GC_push_all_eager
fun:GC_push_current_stack
fun:GC_with_callee_saves_pushed
fun:GC_push_regs_and_stack
fun:GC_push_roots
fun:push_roots_and_advance
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_maybe_gc
fun:GC_collect_a_little_inner
}
{
<insert_a_suppression_name_here>
Memcheck:Value8
fun:GC_add_to_black_list_stack
fun:GC_mark_and_push_stack
fun:GC_push_all_eager
fun:GC_push_current_stack
fun:GC_with_callee_saves_pushed
fun:GC_push_regs_and_stack
fun:GC_push_roots
fun:push_roots_and_advance
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_maybe_gc
fun:GC_collect_a_little_inner
}
{
<insert_a_suppression_name_here>
Memcheck:Cond
fun:GC_push_all_eager
fun:GC_push_all_stack
fun:GC_push_all_stack_sections
fun:GC_push_all_stacks
fun:GC_default_push_other_roots
fun:GC_push_roots
fun:push_roots_and_advance
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_maybe_gc
fun:GC_collect_a_little_inner
fun:GC_start_incremental_collection
}
{
<insert_a_suppression_name_here>
Memcheck:Cond
fun:GC_mark_and_push_stack
fun:GC_push_all_eager
fun:GC_push_all_stack
fun:GC_push_all_stack_sections
fun:GC_push_all_stacks
fun:GC_default_push_other_roots
fun:GC_push_roots
fun:push_roots_and_advance
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_maybe_gc
fun:GC_collect_a_little_inner
}
{
<insert_a_suppression_name_here>
Memcheck:Value8
fun:GC_mark_and_push_stack
fun:GC_push_all_eager
fun:GC_push_all_stack
fun:GC_push_all_stack_sections
fun:GC_push_all_stacks
fun:GC_default_push_other_roots
fun:GC_push_roots
fun:push_roots_and_advance
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_maybe_gc
fun:GC_collect_a_little_inner
}
{
<insert_a_suppression_name_here>
Memcheck:Cond
fun:GC_add_to_black_list_stack
fun:GC_mark_and_push_stack
fun:GC_push_all_eager
fun:GC_push_all_stack
fun:GC_push_all_stack_sections
fun:GC_push_all_stacks
fun:GC_default_push_other_roots
fun:GC_push_roots
fun:push_roots_and_advance
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_maybe_gc
}
{
<insert_a_suppression_name_here>
Memcheck:ReallocZero
fun:realloc
fun:_D4core6thread10threadbase10ThreadBase3addFNbNiCQBuQBsQBoQBfbZv
fun:thread_entryPoint
fun:start_thread
fun:clone
}
{
<insert_a_suppression_name_here>
Memcheck:Cond
fun:GC_is_black_listed
fun:find_nonbl_hblk
fun:GC_allochblk_nth
fun:GC_allochblk
fun:GC_new_hblk
fun:GC_allocobj
fun:GC_generic_malloc_inner_small
fun:GC_generic_malloc_aligned
fun:GC_malloc_kind_aligned_global
fun:GC_malloc_kind_global
fun:GC_malloc_kind
fun:GC_malloc
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: reachable
fun:realloc
fun:_D4core8internal9container6common8xreallocFNbNiPvmZQe
fun:_D4core8internal9container5array__T5ArrayTSQBp2gc11gcinterface5RangeZQBi__T10insertBackZQnMFNbNiQCcZv
fun:_DThn16_4core8internal2gc4impl5protoQo7ProtoGC8addRangeMFNbNiPvmxC8TypeInfoZv
fun:_D2rt6memory16initStaticDataGCFZ14__foreachbody1MFNbNiKSQCc19sections_elf_shared3DSOZi
fun:_D2rt19sections_elf_shared3DSO7opApplyFMDFKSQBqQBqQyZiZi
fun:rt_init
fun:_D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv
fun:_d_run_main2
fun:_d_run_main
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: possible
fun:malloc
fun:_D4core8internal2gc4impl12conservativeQw10initializeFZCQCbQBq11gcinterface2GC
fun:_D4core2gc8registry16createGCInstanceFAyaZCQBpQBn11gcinterface2GC
fun:gc_init
fun:gc_init_nothrow
fun:_DThn16_4core8internal2gc4impl5protoQo7ProtoGC6mallocMFNbmkMxC8TypeInfoZPv
fun:_Dmain
fun:_D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv
fun:_d_run_main2
fun:_d_run_main
fun:main
}