Bug 232235

Summary: devel/valgrind doesn't find trivial leak on head anymore, works on stable/11
Product: Ports & Packages Reporter: Michael Tuexen <tuexen>
Component: Individual Port(s)Assignee: Paul Floyd <pjfloyd>
Status: Closed FIXED    
Severity: Affects Some People CC: nzmjx, paulf, pjfloyd, w.schwarzenfeld
Priority: --- Keywords: regression
Version: Latest   
Hardware: amd64   
OS: Any   
Attachments:
Description Flags
Sample program leaking 1KB none

Description Michael Tuexen freebsd_committer freebsd_triage 2018-10-14 10:06:45 UTC
Created attachment 198117 [details]
Sample program leaking 1KB

When testing valgrind on a stable/11 amd64 system with the attached test program leak.c results in what is expected:

tuexen@stable11:~ % cc -o leak leak.c
tuexen@stable11:~ % valgrind --leak-check=full ./leak
==56478== Memcheck, a memory error detector
==56478== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==56478== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==56478== Command: ./leak
==56478== 
==56478== 
==56478== HEAP SUMMARY:
==56478==     in use at exit: 1,024 bytes in 1 blocks
==56478==   total heap usage: 1 allocs, 0 frees, 1,024 bytes allocated
==56478== 
==56478== 1,024 bytes in 1 blocks are definitely lost in loss record 1 of 1
==56478==    at 0x4C255B5: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck-amd64-freebsd.so)
==56478==    by 0x4007BA: main (in /usr/home/tuexen/leak)
==56478== 
==56478== LEAK SUMMARY:
==56478==    definitely lost: 1,024 bytes in 1 blocks
==56478==    indirectly lost: 0 bytes in 0 blocks
==56478==      possibly lost: 0 bytes in 0 blocks
==56478==    still reachable: 0 bytes in 0 blocks
==56478==         suppressed: 0 bytes in 0 blocks
==56478== 
==56478== For counts of detected and suppressed errors, rerun with: -v
==56478== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

whereas on a head system (r339354) amd64 I get:

tuexen@epyc:~ % cc -o leak leak.c
tuexen@epyc:~ % valgrind ./leak
==1760== Memcheck, a memory error detector
==1760== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==1760== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==1760== Command: ./leak
==1760== 
==1760== 
==1760== HEAP SUMMARY:
==1760==     in use at exit: 0 bytes in 0 blocks
==1760==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==1760== 
==1760== All heap blocks were freed -- no leaks are possible
==1760== 
==1760== For counts of detected and suppressed errors, rerun with: -v
==1760== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Comment 1 Walter Schwarzenfeld freebsd_triage 2019-03-09 08:38:51 UTC
Maintainership dropped ports r495096.
Comment 2 Walter Schwarzenfeld freebsd_triage 2019-03-10 11:45:54 UTC
Assign to new maintainer.
Comment 3 Nazim Can Bedir 2019-03-31 16:25:49 UTC
This is also the case on 12.0-RELEASE (r3416666), as shown below:

$ uname -a
FreeBSD haruko.local 12.0-RELEASE FreeBSD 12.0-RELEASE r341666 GENERIC  amd64
$ valgrind ./trivial
==12924== Memcheck, a memory error detector
==12924== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==12924== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==12924== Command: ./trivial
==12924== 
==12924== 
==12924== HEAP SUMMARY:
==12924==     in use at exit: 0 bytes in 0 blocks
==12924==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==12924== 
==12924== All heap blocks were freed -- no leaks are possible
==12924== 
==12924== For counts of detected and suppressed errors, rerun with: -v
==12924== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Comment 4 Paul Floyd 2020-03-27 19:40:10 UTC
This is what I get from my github repo (https://github.com/paulfloyd/freebsd_valgrind)

paulf> uname -a
FreeBSD euler 12.1-RELEASE-p2 FreeBSD 12.1-RELEASE-p2 GENERIC  amd64


paulf> ./vg-in-place --leak-check=full ./leakcpp.clang++
==21617== Memcheck, a memory error detector
==21617== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==21617== Using Valgrind-3.16.0.GIT and LibVEX; rerun with -h for copyright info
==21617== Command: ./leakcpp.clang++
==21617== 
==21617== 
==21617== HEAP SUMMARY:
==21617==     in use at exit: 1,208 bytes in 4 blocks
==21617==   total heap usage: 4 allocs, 0 frees, 1,208 bytes allocated
==21617== 
==21617== 4 bytes in 1 blocks are definitely lost in loss record 1 of 4
==21617==    at 0x4A4AA85: operator new(unsigned long) (vg_replace_malloc.c:361)
==21617==    by 0x2012F1: main (leak.cpp:3)
==21617== 
==21617== LEAK SUMMARY:
==21617==    definitely lost: 4 bytes in 1 blocks
==21617==    indirectly lost: 0 bytes in 0 blocks
==21617==      possibly lost: 0 bytes in 0 blocks
==21617==    still reachable: 1,204 bytes in 3 blocks
==21617==         suppressed: 0 bytes in 0 blocks
==21617== Reachable blocks (those to which a pointer was found) are not shown.
==21617== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==21617== 
==21617== For lists of detected and suppressed errors, rerun with: -s
==21617== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Comment 5 Paul Floyd 2020-07-30 11:39:45 UTC
This should now be fixed in devel/valgrind-devel and this item can be closed.
Comment 6 Niclas Zeising freebsd_committer freebsd_triage 2021-04-09 13:44:07 UTC
Over to new maintainer.
Comment 7 Paul Floyd 2021-04-10 16:35:36 UTC
This is fixed in both devel/valgrind and devel/valgrind-devel.