Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 04 Feb 2008 16:28:59 +0100
From:      h p <regnans@gmail.com>
To:        Wojciech Puchar <wojtek@wojtek.tensor.gdynia.pl>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: bash bug - or what?
Message-ID:  <47A72F3B.7030902@gmail.com>
In-Reply-To: <20080204161647.V8347@wojtek.tensor.gdynia.pl>
References:  <20080204161647.V8347@wojtek.tensor.gdynia.pl>

next in thread | previous in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?47A72F3B.7030902>