Lars Ellenberg wrote:
> Bash Version: 3.1
> Patch Level: 17
> Release Status: release
>
> (debian etch, bash 3.1dfsg-8)
>
> Description:
> aparently I hit a memory leak in the read builtin.
>
> Repeat-By:
> yes | bash -c 'ulimit -v 1000; while read a ; do :; done'
>
> bash: xmalloc: ../bash/make_cmd.c:99: cannot allocate 2 bytes (0 bytes
> allocated)
>
> note that
> yes | while read; do :; done
> yes | while read a b ; do :; done
> both run "forever".
>
> this apears to be only triggered
> when the number of input fields is larger
> than the number of variables.
>
> Fix:
> I did not check too closely yet,
> nor did I build a debug version or run it through gdb.
>
> But from looking at the code,
> I suspect that in builtins/read.def:647 ...
> the allocated temporary space for t is never FREE'd.
That code is quite different in bash-3.2, and the memory leak is gone.
Chet
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
Live Strong. No day but today.
Chet Ramey, ITS, CWRU [EMAIL PROTECTED] http://cnswww.cns.cwru.edu/~chet/