this is with ./bash instead of bash as valgrind arg valgrind ./bash
==32137== Memcheck, a memory error detector ==32137== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==32137== Using Valgrind-3.17.0 and LibVEX; rerun with -h for copyright info ==32137== Command: ./bash ==32137== ==32139== ==32139== HEAP SUMMARY: ==32139== in use at exit: 169,716 bytes in 817 blocks ==32139== total heap usage: 2,509 allocs, 1,692 frees, 255,621 bytes allocated ==32139== ==32139== LEAK SUMMARY: ==32139== definitely lost: 2,040 bytes in 3 blocks ==32139== indirectly lost: 0 bytes in 0 blocks ==32139== possibly lost: 0 bytes in 0 blocks ==32139== still reachable: 167,676 bytes in 814 blocks ==32139== suppressed: 0 bytes in 0 blocks ==32139== Rerun with --leak-check=full to see details of leaked memory ==32139== ==32139== For lists of detected and suppressed errors, rerun with: -s ==32139== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) ==32143== ==32143== HEAP SUMMARY: ==32143== in use at exit: 171,182 bytes in 846 blocks ==32143== total heap usage: 3,232 allocs, 2,386 frees, 412,605 bytes allocated ==32143== ==32143== LEAK SUMMARY: ==32143== definitely lost: 2,040 bytes in 3 blocks ==32143== indirectly lost: 0 bytes in 0 blocks ==32143== possibly lost: 0 bytes in 0 blocks ==32143== still reachable: 169,142 bytes in 843 blocks ==32143== suppressed: 0 bytes in 0 blocks ==32143== Rerun with --leak-check=full to see details of leaked memory ==32143== ==32143== For lists of detected and suppressed errors, rerun with: -s ==32143== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) ==32150== ==32150== HEAP SUMMARY: ==32150== in use at exit: 172,507 bytes in 870 blocks ==32150== total heap usage: 3,960 allocs, 3,090 frees, 448,152 bytes allocated ==32150== ==32150== LEAK SUMMARY: ==32150== definitely lost: 2,057 bytes in 4 blocks ==32150== indirectly lost: 0 bytes in 0 blocks ==32150== possibly lost: 0 bytes in 0 blocks ==32150== still reachable: 170,450 bytes in 866 blocks ==32150== suppressed: 0 bytes in 0 blocks ==32150== Rerun with --leak-check=full to see details of leaked memory ==32150== ==32150== For lists of detected and suppressed errors, rerun with: -s ==32150== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) ==32154== ==32154== HEAP SUMMARY: ==32154== in use at exit: 724,053 bytes in 2,309 blocks ==32154== total heap usage: 6,432 allocs, 4,123 frees, 1,036,422 bytes allocated ==32154== ==32154== LEAK SUMMARY: ==32154== definitely lost: 2,040 bytes in 3 blocks ==32154== indirectly lost: 0 bytes in 0 blocks ==32154== possibly lost: 0 bytes in 0 blocks ==32154== still reachable: 722,013 bytes in 2,306 blocks ==32154== suppressed: 0 bytes in 0 blocks ==32154== Rerun with --leak-check=full to see details of leaked memory ==32154== ==32154== For lists of detected and suppressed errors, rerun with: -s ==32154== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) ==32158== ==32158== HEAP SUMMARY: ==32158== in use at exit: 723,302 bytes in 2,252 blocks ==32158== total heap usage: 7,070 allocs, 4,818 frees, 1,290,142 bytes allocated ==32158== ==32158== LEAK SUMMARY: ==32158== definitely lost: 2,040 bytes in 3 blocks ==32158== indirectly lost: 0 bytes in 0 blocks ==32158== possibly lost: 0 bytes in 0 blocks ==32158== still reachable: 721,262 bytes in 2,249 blocks ==32158== suppressed: 0 bytes in 0 blocks ==32158== Rerun with --leak-check=full to see details of leaked memory ==32158== ==32158== For lists of detected and suppressed errors, rerun with: -s ==32158== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) ==32165== ==32165== HEAP SUMMARY: ==32165== in use at exit: 723,046 bytes in 2,255 blocks ==32165== total heap usage: 7,765 allocs, 5,510 frees, 1,323,038 bytes allocated ==32165== ==32165== LEAK SUMMARY: ==32165== definitely lost: 2,057 bytes in 4 blocks ==32165== indirectly lost: 0 bytes in 0 blocks ==32165== possibly lost: 0 bytes in 0 blocks ==32165== still reachable: 720,989 bytes in 2,251 blocks ==32165== suppressed: 0 bytes in 0 blocks ==32165== Rerun with --leak-check=full to see details of leaked memory ==32165== ==32165== For lists of detected and suppressed errors, rerun with: -s ==32165== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) ==32171== ==32171== HEAP SUMMARY: ==32171== in use at exit: 776,677 bytes in 4,059 blocks ==32171== total heap usage: 14,294 allocs, 10,235 frees, 1,578,047 bytes allocated ==32171== ==32171== LEAK SUMMARY: ==32171== definitely lost: 2,040 bytes in 3 blocks ==32171== indirectly lost: 0 bytes in 0 blocks ==32171== possibly lost: 0 bytes in 0 blocks ==32171== still reachable: 774,637 bytes in 4,056 blocks ==32171== suppressed: 0 bytes in 0 blocks ==32171== Rerun with --leak-check=full to see details of leaked memory ==32171== ==32171== For lists of detected and suppressed errors, rerun with: -s ==32171== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) 0 exit // 2 old , static 2021-10-14 , Thu Oct , 08:47:11.167010 == 1634201231.167010 # root:0:0 # @ /dev/pts/0 ( 0 ) -> /root/b1 support/ builtins/ po/ doc/ autom4te.cache/ .git/ tests/ m4/ lib/ include/ .made xmalloc.o syntax.o pcomplib.o pcomplete.o redir.o findcmd.o locale.o bashbug* bash* mksignames* bashversion* mksyntax* config.status* configure* exit ==32137== ==32137== HEAP SUMMARY: ==32137== in use at exit: 892,893 bytes in 4,237 blocks ==32137== total heap usage: 15,210 allocs, 10,973 frees, 1,722,069 bytes allocated ==32137== ==32137== LEAK SUMMARY: ==32137== definitely lost: 2,040 bytes in 3 blocks ==32137== indirectly lost: 0 bytes in 0 blocks ==32137== possibly lost: 0 bytes in 0 blocks ==32137== still reachable: 890,853 bytes in 4,234 blocks ==32137== suppressed: 0 bytes in 0 blocks ==32137== Rerun with --leak-check=full to see details of leaked memory ==32137== ==32137== For lists of detected and suppressed errors, rerun with: -s ==32137== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) On Wed, Oct 13, 2021, 15:27 Chet Ramey <chet.ra...@case.edu> wrote: > On 10/12/21 9:15 PM, Alex fxmbsw7 Ratchev wrote: > > could you give me maybe good urls about such to learn ( maybe not too > long > > ones .. ) ? > > You should, with a current bash devel, just be able to run > > make clean > make valgrind > > That disables some bash malloc wrapping functions that confuse valgrind > severely. Then just run > > valgrind bash > or > valgrind --leak-check=full bash > > and see what you get. (Assuming you have valgrind installed, of course, and > depending on what you want to find out). > > If you want to try address sanitizer, make sure you have a compiler that > supports it, then run > > make clean > make asan > > I put the shorthand targets in for convenience. Once you build a bash with > address sanitizer support, you just have to run it and see what it reports. > > Chet > > -- > ``The lyf so short, the craft so long to lerne.'' - Chaucer > ``Ars longa, vita brevis'' - Hippocrates > Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/ >