1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-04 03:00:20 +02:00

mmc: Only add headroom to unfragmentable heaps if no progress

This commit is contained in:
Andy Wingo 2025-05-23 09:38:36 +02:00
parent 140a412ecd
commit f12399ef7d

View file

@ -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;