Red Hat Bugzilla – Bug 115620
/bin/sort -g has memory leak
Last modified: 2007-11-30 17:07:00 EST
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Description of problem:
When sorting large amounts of data using the general numeric
sort flag (-g), it takes huge amounts of memory, and may eventually
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1.perl -le'print rand() foreach 1..5_000_000'|/bin/sort -g > /dev/null
Actual Results: Depending on the size of the input, either uses much
more memory than it should, or it dies with a memory error
(either "Killed" or "Sort: memory exhausted").
Expected Results: I expect it use about 33M of main memory (plus
whatever tmp file space is necessary) to finish the sort.
The binary reports itself as gnu's sort 4.5.3:
$ /bin/sort --version
sort (coreutils) 4.5.3
Written by Mike Haertel and Paul Eggert.
However, if I download and build the 4.5.3 coreutils source
from gnu, that executable does not exhibit this problem. (It
performs the sort using about 33M of main memory)
Indeed. This comes from the i18n patch. I've fixed this in CVS, and
the fix will be part of any future coreutils update for RHEL3.
A fixed package will also appear in Fedora development tree shortly, FWIW.
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.