|
From: Marco T. G. e S. <ma...@ma...> - 2011-05-20 13:09:52
Attachments:
signature.asc
|
Hi.
Please Cc me, since I'm not subscribed to the list.
I posted a question [0] about this in stackoverflow, but
fairuz@##wor...@ir... 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/
|
|
From: Wan M. F. W. I. <wan...@mc...> - 2011-05-20 13:24:42
|
>From user manual: First, a leak is only counted as a true "error" if --leak-check=full is specified. In other words, an unprinted leak is not considered a true "error". If this were not the case, it would be possible to get a high error count but not have any errors printed, which would be confusing. After that, definitely lost and possibly lost blocks are counted as true "errors". Indirectly lost and still reachable blocks are not counted as true "errors", even if --show-reachable=yes is specified and they are printed; this is because such blocks don't need direct fixing by the programmer. Hope it helps. On Fri, May 20, 2011 at 3:08 PM, Marco Túlio Gontijo e Silva < ma...@ma...> wrote: > Hi. > > Please Cc me, since I'm not subscribed to the list. > > I posted a question [0] about this in stackoverflow, but > fairuz@##wor...@ir... 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/ > > > ------------------------------------------------------------------------------ > 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 > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-users > > -- Wan Mohd Fairuz WAN ISMAIL OMAP System Multimedia Integration Team (Trainee) Texas Instrument France +33 (0)4 93 22 20 16 +33 (0)6 43 46 13 39 |
|
From: Marco T. G. e S. <ma...@ma...> - 2011-05-20 13:33:37
Attachments:
signature.asc
|
Excerpts from Wan Mohd Fairuz Wan Ismail's message of Sex Mai 20 10:23:51 -0300 2011: > From user manual: > > First, a leak is only counted as a true "error" if --leak-check=full is > specified. In other words, an unprinted leak is not considered a true > "error". If this were not the case, it would be possible to get a high error > count but not have any errors printed, which would be confusing. > After that, definitely lost and possibly lost blocks are counted as true > "errors". Indirectly lost and still reachable blocks are not counted as true > "errors", even if --show-reachable=yes is specified and they are printed; > this is because such blocks don't need direct fixing by the programmer. I understand that, but I think it would still be useful to have an option for telling valgrind that it should exit with error if there are still reachable, because this makes it easier to automate valgrind calls for this check. Thanks for the reply. > On Fri, May 20, 2011 at 3:08 PM, Marco Túlio Gontijo e Silva < > ma...@ma...> wrote: (...) > > Please Cc me, since I'm not subscribed to the list. Actually, I had to join the list, so no need to Cc me. Sorry for not removing this. Greetings. (...) -- marcot http://marcot.eti.br/ |