[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-25 36b9539: Avoid an infloop when we run out of memo
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] emacs-25 36b9539: Avoid an infloop when we run out of memory |
Date: |
Mon, 11 Jan 2016 16:06:34 +0000 |
branch: emacs-25
commit 36b953947ee2ee0411139bd4ad7dcffdcc403036
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>
Avoid an infloop when we run out of memory
* src/alloc.c (garbage_collect_1): Don't bother saving and
restoring the echo-area message if we are GC'ing after running out
of memory. This avoids an infloop due to repeated attempts to
allocate memory for the cons cell needed to save the message,
which signals the memory-full error, which attempts to save the
echo-area message, which signals memory-full again, etc.
---
src/alloc.c | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/alloc.c b/src/alloc.c
index 8ceacfe..03dacc7 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -5525,9 +5525,16 @@ garbage_collect_1 (void *end)
don't let that cause a recursive GC. */
consing_since_gc = 0;
- /* Save what's currently displayed in the echo area. */
- message_p = push_message ();
- record_unwind_protect_void (pop_message_unwind);
+ /* Save what's currently displayed in the echo area. Don't do that
+ if we are GC'ing because we've run out of memory, since
+ push_message will cons, and we might have no memory for that. */
+ if (NILP (Vmemory_full))
+ {
+ message_p = push_message ();
+ record_unwind_protect_void (pop_message_unwind);
+ }
+ else
+ message_p = false;
/* Save a copy of the contents of the stack, for debugging. */
#if MAX_SAVE_STACK > 0
@@ -5658,7 +5665,7 @@ garbage_collect_1 (void *end)
}
}
- if (garbage_collection_messages)
+ if (garbage_collection_messages && NILP (Vmemory_full))
{
if (message_p || minibuf_level > 0)
restore_message ();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-25 36b9539: Avoid an infloop when we run out of memory,
Eli Zaretskii <=