Chet Ramey <[EMAIL PROTECTED]> writes: > Chet Ramey wrote: >> Andreas Schwab wrote: >> >>> I can still reproduce it with 3.2.25, where the code is identical. >> >> Really? I let the loop run for 45 minutes last night before killing it, >> without a memory allocation error. I'll check again. > > And today it ran for more than an hour. I'm not saying there isn't a > leak; however, it doesn't appear to be very disruptive.
You are definitely not testing the same thing. $ bash --version GNU bash, version 3.2.25(1)-release (powerpc-suse-linux-gnu) Copyright (C) 2005 Free Software Foundation, Inc. $ yes | head -n100 | valgrind --leak-check=full bash -c 'while read a; do :; done' ==9203== Memcheck, a memory error detector. ==9203== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al. ==9203== Using LibVEX rev 1732, a library for dynamic binary translation. ==9203== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP. ==9203== Using valgrind-3.2.3, a dynamic binary instrumentation framework. ==9203== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al. ==9203== For more details, rerun with: -v ==9203== ==9203== ==9203== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 5 from 2) ==9203== malloc/free: in use at exit: 287,292 bytes in 1,092 blocks. ==9203== malloc/free: 5,765 allocs, 4,673 frees, 405,583 bytes allocated. ==9203== For counts of detected errors, rerun with: -v ==9203== searching for pointers to 1,092 not-freed blocks. ==9203== checked 150,908 bytes. ==9203== ==9203== 200 bytes in 100 blocks are definitely lost in loss record 1 of 3 ==9203== at 0x4C6AFE0: malloc (vg_replace_malloc.c:149) ==9203== by 0x707A0: xmalloc (xmalloc.c:87) ==9203== by 0x69DF0: substring (stringlib.c:135) ==9203== by 0x4CA94: string_extract_verbatim (subst.c:971) ==9203== by 0x4CFBC: get_word_from_string (subst.c:2105) ==9203== by 0x7B630: read_builtin (read.def:680) ==9203== by 0x2FC50: execute_builtin (execute_cmd.c:3154) ==9203== by 0x3110C: execute_simple_command (execute_cmd.c:3540) ==9203== by 0x32E14: execute_command_internal (execute_cmd.c:672) ==9203== by 0x337E8: execute_command (execute_cmd.c:352) ==9203== by 0x33930: execute_while_or_until (execute_cmd.c:2350) ==9203== by 0x32B74: execute_command_internal (execute_cmd.c:2318) ==9203== ==9203== LEAK SUMMARY: ==9203== definitely lost: 200 bytes in 100 blocks. ==9203== possibly lost: 0 bytes in 0 blocks. ==9203== still reachable: 287,092 bytes in 992 blocks. ==9203== suppressed: 0 bytes in 0 blocks. ==9203== Reachable blocks (those to which a pointer was found) are not shown. ==9203== To see them, rerun with: --leak-check=full --show-reachable=yes Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."