coreutils
[Top][All Lists]
Advanced

[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 10:24:28 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1

On 06/11/2012 04:47 AM, Voelker, Bernhard wrote:
> shouldn't the  * 0.75 be _instead_ of the /2 then?

In some sense it is "instead" already.
The /2 is for hard limits, i.e.,
the program will crash if you exceed them.
The 0.75 is for a soft limit, i.e., the program will
run (though perhaps slowly) if you exceed it.
The idea is to be more-conservative about hard limits
than about soft ones.

> and I'd put it before the rlimit calculation:
> e.g. a system has 8GB of RAM, but the admin want sort to
> only take 4GB. He'll use ulimit or plimit to 4GB.
> With this patch, sort will only take 3GB.
> Am I wrong?

I think so.  The newly inserted code
"if (total * 0.75 < size) size = total * 0.75;"
is independent of the limits affected by
the ulimit and plimit commands.  In your example
'sort' will consume 4 * 15/16 GB if physmem_available
reports 4 GB available.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]