Hi.

Please Cc me, since I'm not subscribed to the list.

I posted a question [0] about this in stackoverflow, but
fairuz@##[email protected] suggested me to ask on the mailing list,
since it may be a bug on valgrind, and the developers read the list.
Giving a little bit more of details to the question, what I'm currently running
is:

    valgrind --leak-check=full --show-reachable=yes --error-exitcode=1 \
        --quiet ./$< > $@ 2> valgrind.log
    [ ! -s valgrind.log ]

And what I'd like to run is simply:

    valgrind --leak-check=full --show-reachable=yes --error-exitcode=1 \
        --quiet ./$< > $@

Or even:

    valgrind --leak-check=full --error-exitcode=1 \
        --quiet ./$< > $@

In other words, the following commands all result in 0, and I'd like to have
them resulting in 1:

$ valgrind --leak-check=full ./teste2.bin > /dev/null 2>&1; echo $?
$ valgrind --leak-check=full --show-reachable=yes ./teste2.bin > /dev/null \
        2>&1; echo $?

This is the output of the program I'm talking about:

$ valgrind --leak-check=full --show-reachable=yes ./teste2.bin > /dev/null
==14634== Memcheck, a memory error detector
==14634== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==14634== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info
==14634== Command: ./teste2.bin
==14634== 
==14634== 
==14634== HEAP SUMMARY:
==14634==     in use at exit: 28 bytes in 7 blocks
==14634==   total heap usage: 8 allocs, 1 frees, 56 bytes allocated
==14634== 
==14634== 4 bytes in 1 blocks are still reachable in loss record 1 of 7
==14634==    at 0x4C2779D: malloc (vg_replace_malloc.c:236)
==14634==    by 0x4005D5: main (in 
/home/marcot/Documentos/educacao/ufmg/mestrado/disciplinas/programacao_para_arquiteturas_emergentes/h2c/teste2.bin)
==14634== 
==14634== 4 bytes in 1 blocks are still reachable in loss record 2 of 7
==14634==    at 0x4C2779D: malloc (vg_replace_malloc.c:236)
==14634==    by 0x400619: main (in 
/home/marcot/Documentos/educacao/ufmg/mestrado/disciplinas/programacao_para_arquiteturas_emergentes/h2c/teste2.bin)
==14634== 
==14634== 4 bytes in 1 blocks are still reachable in loss record 3 of 7
==14634==    at 0x4C2779D: malloc (vg_replace_malloc.c:236)
==14634==    by 0x400661: main (in 
/home/marcot/Documentos/educacao/ufmg/mestrado/disciplinas/programacao_para_arquiteturas_emergentes/h2c/teste2.bin)
==14634== 
==14634== 4 bytes in 1 blocks are still reachable in loss record 4 of 7
==14634==    at 0x4C2779D: malloc (vg_replace_malloc.c:236)
==14634==    by 0x4006A9: main (in 
/home/marcot/Documentos/educacao/ufmg/mestrado/disciplinas/programacao_para_arquiteturas_emergentes/h2c/teste2.bin)
==14634== 
==14634== 4 bytes in 1 blocks are still reachable in loss record 5 of 7
==14634==    at 0x4C2779D: malloc (vg_replace_malloc.c:236)
==14634==    by 0x4006F1: main (in 
/home/marcot/Documentos/educacao/ufmg/mestrado/disciplinas/programacao_para_arquiteturas_emergentes/h2c/teste2.bin)
==14634== 
==14634== 4 bytes in 1 blocks are still reachable in loss record 6 of 7
==14634==    at 0x4C2779D: malloc (vg_replace_malloc.c:236)
==14634==    by 0x400739: main (in 
/home/marcot/Documentos/educacao/ufmg/mestrado/disciplinas/programacao_para_arquiteturas_emergentes/h2c/teste2.bin)
==14634== 
==14634== 4 bytes in 1 blocks are still reachable in loss record 7 of 7
==14634==    at 0x4C2779D: malloc (vg_replace_malloc.c:236)
==14634==    by 0x400781: main (in 
/home/marcot/Documentos/educacao/ufmg/mestrado/disciplinas/programacao_para_arquiteturas_emergentes/h2c/teste2.bin)
==14634== 
==14634== LEAK SUMMARY:
==14634==    definitely lost: 0 bytes in 0 blocks
==14634==    indirectly lost: 0 bytes in 0 blocks
==14634==      possibly lost: 0 bytes in 0 blocks
==14634==    still reachable: 28 bytes in 7 blocks
==14634==         suppressed: 0 bytes in 0 blocks
==14634== 
==14634== For counts of detected and suppressed errors, rerun with: -v
==14634== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 4 from 4)

0: 
http://stackoverflow.com/questions/6070995/how-to-make-valgrind-report-an-error-when-there-are-still-reachable-allocs
-- 
marcot
http://marcot.eti.br/

Attachment: signature.asc
Description: PGP signature

------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to