diff options
author | Jim Meyering <jim@meyering.net> | 2001-04-15 05:58:33 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2001-04-15 05:58:33 +0000 |
commit | 4b9aaf267e97db735549db1bafe130bde879586a (patch) | |
tree | 531315f24d8f07d080d7f1c9b56db274e7e21259 | |
parent | 9d3cbe12bd2d8e6dc595021df4cebd05649d97a2 (diff) | |
download | coreutils-4b9aaf267e97db735549db1bafe130bde879586a.tar.xz |
(default_sort_size): Leave a 1/16 margin for RSS.
-rw-r--r-- | src/sort.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/sort.c b/src/sort.c index 7f7876537..ecfa8287f 100644 --- a/src/sort.c +++ b/src/sort.c @@ -672,8 +672,10 @@ default_sort_size (void) size /= 2; #ifdef RLIMIT_RSS - if (getrlimit (RLIMIT_RSS, &rlimit) == 0 && rlimit.rlim_cur < size) - size = rlimit.rlim_cur; + /* Leave a 1/16 margin for RSS to leave room for code, stack, etc. + Exceeding RSS is not fatal, but can be quite slow. */ + if (getrlimit (RLIMIT_RSS, &rlimit) == 0 && rlimit.rlim_cur / 16 * 15 < size) + size = rlimit.rlim_cur / 16 * 15; #endif /* Use no less than the minimum. */ |