bash bug - or what?

h p regnans at gmail.com
Mon Feb 4 15:54:59 UTC 2008


Wojciech Puchar wrote:
> look at this
>
> $SORT is sort -S 512m
>
> $tmp2  is input filename (being 2GB size), $tmp3 is output
>
> this fragment tries (with success) to randomize lines from $tmp2 and 
> write it to $tmp3
>
> while read ll;do
>  echo $RANDOM $RANDOM $ll
> done <$tmp2 | $SORT |cut -f 3- -d " " >$tmp3
>
>
>
> this works but why bash sucks VM space?
>
> 69274 test              1  -8    0  1862M 98008K pipewr 1   8:17 
> 40.28% bash
>
>
> this 1862 is growing until it finishes, resident size is 100M because 
> it gets swapped out.
>
>
> it looks like echo'ed data is kept in bash memory
I think that's the way it should be, because sort needs the whole output 
of the loop before it can begin sorting.


More information about the freebsd-questions mailing list