[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/emacs-24 r110784: Fix bug #12774 with crash
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/emacs-24 r110784: Fix bug #12774 with crashes in ralloc.c. |
Date: |
Mon, 05 Nov 2012 19:23:25 +0200 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 110784
fixes bug: http://debbugs.gnu.org/12774
committer: Eli Zaretskii <address@hidden>
branch nick: emacs-24
timestamp: Mon 2012-11-05 19:23:25 +0200
message:
Fix bug #12774 with crashes in ralloc.c.
src/ralloc.c (relinquish): If real_morecore fails to return memory
to the system, don't crash; instead, leave the last heap
unchanged and return.
modified:
src/ChangeLog
src/ralloc.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2012-11-03 13:58:33 +0000
+++ b/src/ChangeLog 2012-11-05 17:23:25 +0000
@@ -1,3 +1,9 @@
+2012-11-05 Eli Zaretskii <address@hidden>
+
+ * ralloc.c (relinquish): If real_morecore fails to return memory
+ to the system, don't crash; instead, leave the last heap
+ unchanged and return. (Bug#12774)
+
2012-11-03 Eli Zaretskii <address@hidden>
* lisp.mk: Adjust comments to the fact that term/internal is now
=== modified file 'src/ralloc.c'
--- a/src/ralloc.c 2012-10-07 18:33:10 +0000
+++ b/src/ralloc.c 2012-11-05 17:23:25 +0000
@@ -327,6 +327,8 @@
if ((char *)last_heap->end - (char *)last_heap->bloc_start <= excess)
{
+ heap_ptr lh_prev;
+
/* This heap should have no blocs in it. If it does, we
cannot return it to the system. */
if (last_heap->first_bloc != NIL_BLOC
@@ -335,28 +337,26 @@
/* Return the last heap, with its header, to the system. */
excess = (char *)last_heap->end - (char *)last_heap->start;
- last_heap = last_heap->prev;
- last_heap->next = NIL_HEAP;
+ lh_prev = last_heap->prev;
+ /* If the system doesn't want that much memory back, leave
+ last_heap unaltered to reflect that. This can occur if
+ break_value is still within the original data segment. */
+ if ((*real_morecore) (- excess) != 0)
+ {
+ last_heap = lh_prev;
+ last_heap->next = NIL_HEAP;
+ }
}
else
{
excess = (char *) last_heap->end
- (char *) ROUNDUP ((char *)last_heap->end - excess);
- last_heap->end = (char *) last_heap->end - excess;
- }
-
- if ((*real_morecore) (- excess) == 0)
- {
- /* If the system didn't want that much memory back, adjust
- the end of the last heap to reflect that. This can occur
- if break_value is still within the original data segment. */
- last_heap->end = (char *) last_heap->end + excess;
- /* Make sure that the result of the adjustment is accurate.
- It should be, for the else clause above; the other case,
- which returns the entire last heap to the system, seems
- unlikely to trigger this mode of failure. */
- if (last_heap->end != (*real_morecore) (0))
- emacs_abort ();
+ /* If the system doesn't want that much memory back, leave
+ the end of the last heap unchanged to reflect that. This
+ can occur if break_value is still within the original
+ data segment. */
+ if ((*real_morecore) (- excess) != 0)
+ last_heap->end = (char *) last_heap->end - excess;
}
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/emacs-24 r110784: Fix bug #12774 with crashes in ralloc.c.,
Eli Zaretskii <=