bash bug - or what?

Wojciech Puchar wojtek at wojtek.tensor.gdynia.pl
Mon Feb 4 15:21:55 UTC 2008


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

what's wrong?


More information about the freebsd-questions mailing list