]> code.delx.au - gnu-emacs/blobdiff - src/vm-limit.c
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-99
[gnu-emacs] / src / vm-limit.c
index 0e294413461bd5b9eadc30e5f223b12241546c5a..0c12dec9b046a911d8ff4726b3956e1dac5e24f4 100644 (file)
@@ -1,5 +1,6 @@
 /* Functions for memory limit warnings.
-   Copyright (C) 1990, 1992 Free Software Foundation, Inc.
+   Copyright (C) 1990, 1992, 2002, 2003, 2004,
+                 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -15,7 +16,8 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with GNU Emacs; see the file COPYING.  If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
 
 #ifdef emacs
 #include <config.h>
@@ -49,8 +51,12 @@ static void (*warn_function) ();
 static void
 check_memory_limits ()
 {
+#ifdef REL_ALLOC
+  extern POINTER (*real_morecore) ();
+#endif
   extern POINTER (*__morecore) ();
 
+
   register POINTER cp;
   unsigned long five_percent;
   unsigned long data_size;
@@ -60,13 +66,18 @@ check_memory_limits ()
   five_percent = lim_data / 20;
 
   /* Find current end of memory and issue warning if getting near max */
+#ifdef REL_ALLOC
+  if (real_morecore)
+    cp = (char *) (*real_morecore) (0);
+  else
+#endif
   cp = (char *) (*__morecore) (0);
   data_size = (char *) cp - (char *) data_space_start;
 
   if (warn_function)
     switch (warnlevel)
       {
-      case 0: 
+      case 0:
        if (data_size > five_percent * 15)
          {
            warnlevel++;
@@ -74,7 +85,7 @@ check_memory_limits ()
          }
        break;
 
-      case 1: 
+      case 1:
        if (data_size > five_percent * 17)
          {
            warnlevel++;
@@ -82,7 +93,7 @@ check_memory_limits ()
          }
        break;
 
-      case 2: 
+      case 2:
        if (data_size > five_percent * 19)
          {
            warnlevel++;
@@ -129,4 +140,12 @@ memory_warnings (start, warnfun)
 
   warn_function = warnfun;
   __after_morecore_hook = check_memory_limits;
+
+#ifdef WINDOWSNT
+  /* Force data limit to be recalculated on each run.  */
+  lim_data = 0;
+#endif
 }
+
+/* arch-tag: eab04eda-1f69-447a-8d9f-95f0a3983ca5
+   (do not change this comment) */