[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/vm-limit.c,v [EMACS_22_BASE]
From: |
Chong Yidong |
Subject: |
[Emacs-diffs] Changes to emacs/src/vm-limit.c,v [EMACS_22_BASE] |
Date: |
Sat, 02 Aug 2008 22:37:00 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Branch: EMACS_22_BASE
Changes by: Chong Yidong <cyd> 08/08/02 22:37:00
Index: vm-limit.c
===================================================================
RCS file: /sources/emacs/emacs/src/vm-limit.c,v
retrieving revision 1.20.2.2
retrieving revision 1.20.2.3
diff -u -b -r1.20.2.2 -r1.20.2.3
--- vm-limit.c 8 Jan 2008 04:29:47 -0000 1.20.2.2
+++ vm-limit.c 2 Aug 2008 22:37:00 -0000 1.20.2.3
@@ -149,24 +149,21 @@
#endif
extern POINTER (*__morecore) ();
-
register POINTER cp;
unsigned long five_percent;
unsigned long data_size;
enum warnlevel new_warnlevel;
-#ifdef HAVE_GETRLIMIT
+ /* Cygwin has a faulty getrlimit implementation:
+ http://lists.gnu.org/archive/html/emacs-devel/2008-08/msg00125.html */
+#if defined (HAVE_GETRLIMIT) && ! defined (CYGWIN)
struct rlimit rlimit;
getrlimit (RLIMIT_AS, &rlimit);
-
- if (RLIM_INFINITY == rlimit.rlim_max)
- return;
-
+ if (RLIM_INFINITY == rlimit.rlim_max
/* This is a nonsensical case, but it happens -- rms. */
- if (rlimit.rlim_cur > rlimit.rlim_max)
+ || rlimit.rlim_cur > rlimit.rlim_max)
return;
-
five_percent = rlimit.rlim_max / 20;
data_size = rlimit.rlim_cur;
@@ -191,14 +188,11 @@
return;
/* What level of warning does current memory usage demand? */
- if (data_size > five_percent * 19)
- new_warnlevel = warned_95;
- else if (data_size > five_percent * 17)
- new_warnlevel = warned_85;
- else if (data_size > five_percent * 15)
- new_warnlevel = warned_75;
- else
- new_warnlevel = not_warned;
+ new_warnlevel
+ = (data_size > five_percent * 19) ? warned_95
+ : (data_size > five_percent * 17) ? warned_85
+ : (data_size > five_percent * 15) ? warned_75
+ : not_warned;
/* If we have gone up a level, give the appropriate warning. */
if (new_warnlevel > warnlevel || new_warnlevel == warned_95)
@@ -235,8 +229,10 @@
warnlevel = warned_85;
}
+#if ! defined (HAVE_GETRLIMIT) || defined (CYGWIN)
if (EXCEEDS_LISP_PTR (cp))
(*warn_function) ("Warning: memory in use exceeds lisp pointer size");
+#endif
}
/* Enable memory usage warnings.
- [Emacs-diffs] Changes to emacs/src/vm-limit.c,v [EMACS_22_BASE],
Chong Yidong <=