summaryrefslogtreecommitdiff
path: root/src/ralloc.c
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1997-09-27 16:01:00 +0000
committerKarl Heuer <kwzh@gnu.org>1997-09-27 16:01:00 +0000
commit21532667504895f38a433d23f27bdcad9f989dd5 (patch)
treee562e00a356d616af1874f7cd51a6e35de9df4fd /src/ralloc.c
parent2c1e5f9b25cc8c277c8af90b0c2ce0d36ed5b3f1 (diff)
downloademacs-21532667504895f38a433d23f27bdcad9f989dd5.tar.gz
(relinquish): When returning memory to the system,
watch out for the original data segment boundary.
Diffstat (limited to 'src/ralloc.c')
-rw-r--r--src/ralloc.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/ralloc.c b/src/ralloc.c
index d1ce3be24fc..183db755412 100644
--- a/src/ralloc.c
+++ b/src/ralloc.c
@@ -363,7 +363,18 @@ relinquish ()
}
if ((*real_morecore) (- excess) == 0)
- abort ();
+ {
+ /* 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 += 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))
+ abort ();
+ }
}
}