-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LDC: Valgrind detect memory leak #68
Comments
more tests $> export ASAN_OPTIONS=abort_on_error=0:fast_unwind_on_malloc=0:detect_leaks=1 UBSAN_OPTIONS=print_stacktrace=1
$> ./openldc2-0655f30f-linux-x86_64/bin/ldc2 hello.d -fsanitize=memory -static
/usr/bin/ld: /home/kassane/Downloads/openldc2-0655f30f-linux-x86_64/bin/../lib/libldc_rt.msan.a(msan_interceptors.cpp.o): in function `InitializeCommonInterceptors()':
/home/runner/work/llvm-project/llvm-project/compiler-rt/lib/msan/../sanitizer_common/sanitizer_common_interceptors.inc:10448:(.text._ZL28InitializeCommonInterceptorsv+0x61bb): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /home/kassane/Downloads/openldc2-0655f30f-linux-x86_64/bin/../lib/libldc_rt.msan.a(msan_interceptors.cpp.o): note: the message above does not take linker garbage collection into account
$> ./hello
MemorySanitizer: CHECK failed: sanitizer_common_interceptors_memintrinsics.inc:239 "((__interception::real_memcpy)) != (0)" (0x0, 0x0) (tid=19145)
<empty stack> Reference |
I think upstream had something similar to this a while ago, possible we introduced something new here but also possible there is a commit from them we can cherry pick to solve it. |
It's also worth investigating whether this only happens on archlinux. |
opend/druntime/src/core/internal/gc/impl/conservative/gc.d Lines 138 to 147 in 45eb187
|
That makes sense, I guess it is kinda a leak because it isn't freed explicitly, but it is meant to live through the lifetime of the process. Do you know if there's an easy way to just tell valgrind "don't worry about this"? |
Suppressions? valgrind-suppression-stdout$ valgrind --leak-check=full --show-reachable=yes -v --track-origins=yes --show-leak-kinds=all --error-limit=no --gen-suppressions=all --log-fd=9 ./start 9>>memcheck.log
$ ./suppression.sh memcheck.log
{
<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:(below main)
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: reachable
fun:realloc
fun:_D4core2gc8registry17registerGCFactoryFNbNiAyaPFZCQBwQBu11gcinterface2GCZv
fun:call_init
fun:__libc_start_main@@GLIBC_2.34
fun:(below main)
}
$ ./suppression.sh memcheck.log > druntime.supp
$ valgrind --leak-check=full --show-leak-kinds=all --suppressions=druntime.supp ./start ==112438== Memcheck, a memory error detector
==112438== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==112438== Using Valgrind-3.22.0 and LibVEX; rerun with -h for copyright info
==112438== Command: ./start
==112438==
==112438==
==112438== HEAP SUMMARY:
==112438== in use at exit: 96 bytes in 2 blocks
==112438== total heap usage: 232 allocs, 230 frees, 47,595 bytes allocated
==112438==
==112438== LEAK SUMMARY:
==112438== definitely lost: 0 bytes in 0 blocks
==112438== indirectly lost: 0 bytes in 0 blocks
==112438== possibly lost: 0 bytes in 0 blocks
==112438== still reachable: 0 bytes in 0 blocks
==112438== suppressed: 96 bytes in 2 blocks
==112438==
==112438== For lists of detected and suppressed errors, rerun with: -s
==112438== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) References |
Arch: x86-64 (zen3)
OS: ArchLinux (glibc)
Note: on alpine-musl not issue.
build - output
static-build - output
Sanitizer=memory
Reference
The text was updated successfully, but these errors were encountered: