https://bugs.kde.org/show_bug.cgi?id=515183

--- Comment #8 from daxin <[email protected]> ---
(In reply to Paul Floyd from comment #7)
> (In reply to daxin from comment #6)
> 
> > Historical versions used --num-callers=1 to execute the test and pass.
> 
> That doesn't mean that it made any sense or was useful in a general way.
> 
> Take this example
> 
> #include <stdlib.h>
> 
> int main(void)
> {
>    // deliberately leak 4Gbytes
>    int* pi = malloc(1000000000*sizeof(*pi));
>    pi = NULL;
> }
> 
> With the default num-callers and --leak-check=full that gives
> 
> ==468== HEAP SUMMARY:
> ==468==     in use at exit: 4,000,000,000 bytes in 1 blocks
> ==468==   total heap usage: 1 allocs, 0 frees, 4,000,000,000 bytes allocated
> ==468==
> ==468== 4,000,000,000 bytes in 1 blocks are possibly lost in loss record 1
> of 1
> ==468==    at 0x483EA32: malloc (vg_replace_malloc.c:447)
> ==468==    by 0x40047A: main (bigleak.c:6)
> ==468==
> ==468== LEAK SUMMARY:
> ==468==    definitely lost: 0 bytes in 0 blocks
> ==468==    indirectly lost: 0 bytes in 0 blocks
> ==468==      possibly lost: 4,000,000,000 bytes in 1 blocks
> ==468==    still reachable: 0 bytes in 0 blocks
> ==468==         suppressed: 0 bytes in 0 blocks
> ==468==
> ==468== For lists of detected and suppressed errors, rerun with: -s
> ==468== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
> 
> If I "fix" the default suppression to allow --num-callers=1 then I get
> 
> ==453== HEAP SUMMARY:
> ==453==     in use at exit: 4,000,000,000 bytes in 1 blocks
> ==453==   total heap usage: 1 allocs, 0 frees, 4,000,000,000 bytes allocated
> ==453==
> ==453== LEAK SUMMARY:
> ==453==    definitely lost: 0 bytes in 0 blocks
> ==453==    indirectly lost: 0 bytes in 0 blocks
> ==453==      possibly lost: 0 bytes in 0 blocks
> ==453==    still reachable: 0 bytes in 0 blocks
> ==453==         suppressed: 4,000,000,000 bytes in 1 blocks
> ==453==
> ==453== For lists of detected and suppressed errors, rerun with: -s
> ==453== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
> 
> Both DRD and Helgrind have several default suppressions with ... at the top
> level of the callstack on all platforms.
> 
> Darwin memcheck has quite a few top level ... suppressions, none for FreeBSD
> or Solaris.
> 
> There are two reasons why we use wildcards in suppressions.
> 1. To avoid having to write many explicit suppressions.
> 2. To make the suppressions more robust and future proof. We regularly need
> to update the suppressions due to changes in the various libc/libpthread
> implementations. Without wildcards that would happen more often.
> 
> It looks to me as though your issue is with a small artificial testcase
> rather than a real world production application.
> 
> Making 2 the lower limit for --num-callers is a trivial change. That would
> give
> 
> $ ./vg-in-place --tool=drd --num-callers=1 helgrind/tests/hg01_all_ok
> valgrind: Bad option: --num-callers=1
> valgrind: '--num-callers' argument must be between 2 and 500
> valgrind: Use --help for more information or consult the user manual.

ok, thank you for your answer, it was very helpful to me

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to