wingo pushed a commit to branch wip-whippet
in repository guile.

commit f12399ef7dfdf792c1bc0782a49e18a3c2bce632
Author: Andy Wingo <wi...@igalia.com>
AuthorDate: Fri May 23 09:38:36 2025 +0200

    mmc: Only add headroom to unfragmentable heaps if no progress
---
 src/mmc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/mmc.c b/src/mmc.c
index cd5b93be7..b35fd58b1 100644
--- a/src/mmc.c
+++ b/src/mmc.c
@@ -586,9 +586,11 @@ grow_heap_if_necessary(struct gc_heap *heap,
   struct nofl_space *nofl = heap_nofl_space(heap);
   size_t pending = nofl_space_shrink(nofl, 0);
 
+  // If we cannot defragment and are making no progress but have a
+  // growable heap, expand by 25% to add some headroom.
   size_t needed_headroom =
     GC_CONSERVATIVE_TRACE
-    ? nofl_active_block_count (nofl) * NOFL_BLOCK_SIZE / 16
+    ? (progress ? 0 : nofl_active_block_count (nofl) * NOFL_BLOCK_SIZE / 4)
     : 0;
   size_t headroom = nofl_empty_block_count(nofl) * NOFL_BLOCK_SIZE;
 

Reply via email to