From: Taylor R. Campbell Date: Sat, 10 Feb 2007 19:17:38 +0000 (+0000) Subject: In the GARBAGE-COLLECT primitive, return the available heap space X-Git-Tag: 20090517-FFI~736 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=d0b8d91ea53aac73cef2194d93414b6165ad78e8;p=mit-scheme.git In the GARBAGE-COLLECT primitive, return the available heap space minus gc_space_needed, in case it was called by a primitive that requested a certain amount of space for allocation. If we report only the newly available heap space and ignore gc_space_needed, then GC-FINISH will consider there to be ample space to proceed (more than 4096 bytes), and the primitive will be restarted only to repeat the call to the GC, looping endlessly. --- diff --git a/v7/src/microcode/bchmmg.c b/v7/src/microcode/bchmmg.c index 7d3af3298..0bd4b76d9 100644 --- a/v7/src/microcode/bchmmg.c +++ b/v7/src/microcode/bchmmg.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: bchmmg.c,v 9.107 2007/01/12 03:45:55 cph Exp $ +$Id: bchmmg.c,v 9.108 2007/02/10 19:17:38 riastradh Exp $ Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, @@ -3402,7 +3402,7 @@ DEFINE_PRIMITIVE ("GARBAGE-COLLECT", Prim_garbage_collect, 1, 1, 0) Will_Push (CONTINUATION_SIZE); Store_Return (RC_NORMAL_GC_DONE); - exp_register = (LONG_TO_UNSIGNED_FIXNUM (MemTop - Free)); + exp_register = (LONG_TO_UNSIGNED_FIXNUM (MemTop - Free - GC_Space_Needed)); Save_Cont (); Pushed (); diff --git a/v7/src/microcode/memmag.c b/v7/src/microcode/memmag.c index a0fecc310..f75c786b7 100644 --- a/v7/src/microcode/memmag.c +++ b/v7/src/microcode/memmag.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: memmag.c,v 9.74 2007/01/05 21:19:25 cph Exp $ +$Id: memmag.c,v 9.75 2007/02/10 19:17:38 riastradh Exp $ Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, @@ -650,7 +650,7 @@ DEFINE_PRIMITIVE ("GARBAGE-COLLECT", Prim_garbage_collect, 1, 1, 0) Will_Push (CONTINUATION_SIZE); Store_Return (RC_NORMAL_GC_DONE); - exp_register = (LONG_TO_UNSIGNED_FIXNUM (MemTop - Free)); + exp_register = (LONG_TO_UNSIGNED_FIXNUM (MemTop - Free - GC_Space_Needed)); Save_Cont (); Pushed ();