mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-22 07:09:54 +00:00
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.
This commit is contained in:
parent
200675299e
commit
36b953947e
15
src/alloc.c
15
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 ();
|
||||
|
Loading…
Reference in New Issue
Block a user