sort(1) memory usage
Ed Schouten
ed at fxq.nl
Sun Feb 3 05:13:12 PST 2008
* Dag-Erling Smørgrav <des at des.no> wrote:
> I've been trying to figure out why some periodic scripts consume so much
> memory. I've narrowed it down to sort(1).
>
> At first, I thought the scripts were using it inefficiently, feeding it
> more data than was really needed. Then I discovered this:
>
> des at ds4 ~% (sleep 10 | sort) & (sleep 5 ; top -o res | grep sort)
> [1] 66024
> 66024 des 1 -8 5 54796K 52680K piperd 1 0:00 0.88% sort
>
> That's right - sort(1) consumes 50+ MB of memory doing *nothing*.
>
> (roughly half that on a 32-bit box)
>
> Something is rotten in the state of GNU...
On my i386 box it spends 27M, but when I replace `sort' with `sed',
without any arguments, it's only 1.4 MB. I tried this on RELENG_6. I can
also reproduce this on Linux.
--
Ed Schouten <ed at fxq.nl>
WWW: http://g-rave.nl/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20080203/28fbe3ef/attachment.pgp
More information about the freebsd-hackers
mailing list