changeset 19999:cc8daec6d363

(relinquish): When returning memory to the system, watch out for the original data segment boundary.
author Karl Heuer <kwzh@gnu.org>
date Sat, 27 Sep 1997 16:01:00 +0000
parents b93ac48bafd1
children ccccaf435fdd
files src/ralloc.c
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/ralloc.c	Fri Sep 26 21:39:10 1997 +0000
+++ b/src/ralloc.c	Sat Sep 27 16:01:00 1997 +0000
@@ -363,7 +363,18 @@
 	}
 
       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 ();
+	}
     }
 }