mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
bbf7c43c37
heapify() and heap_delete_root() call mrb_gc_protect() to guard a C-local mrb_value across potential GC points inside sort_cmp(). They were missing the matching mrb_gc_arena_save/restore pair, so each call leaked one arena slot. For O(n log n) heapify calls under MRB_GC_FIXED_ARENA this overflows the 100-slot arena and raises NoMemoryError, e.g. during Array#repeated_permutation tests. Wrap each function body with mrb_gc_arena_save/restore, matching the pattern already used in insertion_sort() above. Co-authored-by: Claude <noreply@anthropic.com>