diff src/alloc.c @ 83143:9fb10038ca55

Merged in changes from CVS trunk. Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-353 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-354 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-355 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-356 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-183
author Karoly Lorentey <lorentey@elte.hu>
date Mon, 31 May 2004 13:48:26 +0000
parents 62cf3d6337a0 ca648e6d2d7b
children dbcd0af66869
line wrap: on
line diff
--- a/src/alloc.c	Sun May 30 21:11:48 2004 +0000
+++ b/src/alloc.c	Mon May 31 13:48:26 2004 +0000
@@ -155,6 +155,7 @@
 
 EMACS_INT undo_limit;
 EMACS_INT undo_strong_limit;
+EMACS_INT undo_outer_limit;
 
 /* Number of live and free conses etc.  */
 
@@ -755,17 +756,20 @@
 #ifdef HAVE_POSIX_MEMALIGN
       {
 	int err = posix_memalign (&base, BLOCK_ALIGN, ABLOCKS_BYTES);
-	abase = err ? (base = NULL) : base;
+	if (err)
+	  base = NULL;
+	abase = base;
       }
 #else
       base = malloc (ABLOCKS_BYTES);
       abase = ALIGN (base, BLOCK_ALIGN);
+#endif
+
       if (base == 0)
 	{
 	  UNBLOCK_INPUT;
 	  memory_full ();
 	}
-#endif
 
       aligned = (base == abase);
       if (!aligned)
@@ -4381,7 +4385,7 @@
 	if (! EQ (nextb->undo_list, Qt))
 	  nextb->undo_list
 	    = truncate_undo_list (nextb->undo_list, undo_limit,
-				  undo_strong_limit);
+				  undo_strong_limit, undo_outer_limit);
 
 	/* Shrink buffer gaps, but skip indirect and dead buffers.  */
 	if (nextb->base_buffer == 0 && !NILP (nextb->name))
@@ -5668,12 +5672,20 @@
 
   DEFVAR_INT ("undo-strong-limit", &undo_strong_limit,
 	      doc: /* Don't keep more than this much size of undo information.
-A command which pushes past this size is itself forgotten.
-This limit is applied when garbage collection happens.
+A previous command which pushes the undo list past this size
+is entirely forgotten when GC happens.
 The size is counted as the number of bytes occupied,
 which includes both saved text and other data.  */);
   undo_strong_limit = 30000;
 
+  DEFVAR_INT ("undo-outer-limit", &undo_outer_limit,
+	      doc: /* Don't keep more than this much size of undo information.
+If the current command has produced more than this much undo information,
+GC discards it.  This is a last-ditch limit to prevent memory overflow.
+The size is counted as the number of bytes occupied,
+which includes both saved text and other data.  */);
+  undo_outer_limit = 300000;
+
   DEFVAR_BOOL ("garbage-collection-messages", &garbage_collection_messages,
 	       doc: /* Non-nil means display messages at start and end of garbage collection.  */);
   garbage_collection_messages = 0;