summaryrefslogtreecommitdiff
path: root/src/ralloc.c
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2012-11-10 15:13:33 -0800
committerGlenn Morris <rgm@gnu.org>2012-11-10 15:13:33 -0800
commit6baf66d53bbedd85a443e0d69d1f4311a93f0677 (patch)
tree38d7a00d5f7d5aecb86285d334fa15a31e5fbab1 /src/ralloc.c
parent05a859c1bd9cd07b2c0fad06a0694e88ea929fcf (diff)
parente4e46889223296e8875548d278340b21db449a4a (diff)
downloademacs-6baf66d53bbedd85a443e0d69d1f4311a93f0677.tar.gz
emacs-6baf66d53bbedd85a443e0d69d1f4311a93f0677.tar.bz2
emacs-6baf66d53bbedd85a443e0d69d1f4311a93f0677.zip
Merge from emacs-24; up to 2012-11-08T14:54:03Z!monnier@iro.umontreal.ca
Diffstat (limited to 'src/ralloc.c')
-rw-r--r--src/ralloc.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/ralloc.c b/src/ralloc.c
index 11897411930..e5bf76b0e6d 100644
--- a/src/ralloc.c
+++ b/src/ralloc.c
@@ -327,6 +327,8 @@ relinquish (void)
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 @@ relinquish (void)
/* 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;
}
}
}