[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: overly aggressive memory usage by sort.c
From: |
Paul Eggert |
Subject: |
Re: overly aggressive memory usage by sort.c |
Date: |
Mon, 11 Jun 2012 03:02:49 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 |
On 06/10/2012 11:30 PM, Jim Meyering wrote:
> Any objection to reverting that and adjusting the comment to match?
Yes, as this would run afoul of bug 10877
<http://bugs.gnu.org/10877>. Instead,
I suggest following Jeff Janes's advice
and installing the following patch:
>From c498519fcf4e4a2cc93c1ca75d0b263e215fc01a Mon Sep 17 00:00:00 2001
From: Paul Eggert <address@hidden>
Date: Mon, 11 Jun 2012 02:47:05 -0700
Subject: [PATCH] sort: by default, do not exceed 3/4 of physical memory
* src/sort.c (default_sort_size): Do not exceed 3/4 of total memory.
See Jeff Janes's bug report in
<http://lists.gnu.org/archive/html/coreutils/2012-06/msg00018.html>.
---
src/sort.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/sort.c b/src/sort.c
index 2593a2a..a517f4e 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -1412,10 +1412,13 @@ default_sort_size (void)
double mem = MAX (avail, total / 8);
struct rlimit rlimit;
- /* Let SIZE be MEM, but no more than the maximum object size or
- system resource limits. Don't bother to check for values like
- RLIM_INFINITY since in practice they are not much less than SIZE_MAX. */
+ /* Let SIZE be MEM, but no more than the maximum object size, 3/4 of
+ total memory, or system resource limits. Don't bother to check
+ for values like RLIM_INFINITY since in practice they are not much
+ less than SIZE_MAX. */
size_t size = SIZE_MAX;
+ if (total * 0.75 < size)
+ size = total * 0.75;
if (getrlimit (RLIMIT_DATA, &rlimit) == 0 && rlimit.rlim_cur < size)
size = rlimit.rlim_cur;
#ifdef RLIMIT_AS
--
1.7.6.5
- overly aggressive memory usage by sort.c, Jeff Janes, 2012/06/07
- Re: overly aggressive memory usage by sort.c, Pádraig Brady, 2012/06/07
- Re: overly aggressive memory usage by sort.c, Jim Meyering, 2012/06/11
- Re: overly aggressive memory usage by sort.c,
Paul Eggert <=
- Re: overly aggressive memory usage by sort.c, Paul Eggert, 2012/06/11
- RE: overly aggressive memory usage by sort.c, Voelker, Bernhard, 2012/06/11
- Re: overly aggressive memory usage by sort.c, Paul Eggert, 2012/06/11
- [PATCH] maint: cleanup size determination in sort [was: overly aggressive memory usage by sort.c], Bernhard Voelker, 2012/06/14
- Re: [PATCH] maint: cleanup size determination in sort [was: overly aggressive memory usage by sort.c], Jim Meyering, 2012/06/20
- Re: [PATCH] maint: cleanup size determination in sort [was: overly aggressive memory usage by sort.c], Jeff Janes, 2012/06/20
- Re: [PATCH] maint: cleanup size determination in sort [was: overly aggressive memory usage by sort.c], Jim Meyering, 2012/06/20
- Re: [PATCH] maint: cleanup size determination in sort [was: overly aggressive memory usage by sort.c], Paul Eggert, 2012/06/20
- Re: overly aggressive memory usage by sort.c, Jeff Janes, 2012/06/12