diff options
Diffstat (limited to 'enum.c')
-rw-r--r-- | enum.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -14,6 +14,7 @@ #include "ruby/util.h" #include "id.h" #include "symbol.h" +#include "transient_heap.h" #include <assert.h> @@ -1171,9 +1172,10 @@ enum_sort_by(VALUE obj) rb_ary_concat(ary, buf); } if (RARRAY_LEN(ary) > 2) { - RARRAY_PTR_USE(ary, ptr, - ruby_qsort(ptr, RARRAY_LEN(ary)/2, 2*sizeof(VALUE), - sort_by_cmp, (void *)ary)); + rb_ary_transient_heap_evacuate(ary, TRUE); /* should be malloc heap */ + RARRAY_PTR_USE(ary, ptr, + ruby_qsort(ptr, RARRAY_LEN(ary)/2, 2*sizeof(VALUE), + sort_by_cmp, (void *)ary)); } if (RBASIC(ary)->klass) { rb_raise(rb_eRuntimeError, "sort_by reentered"); |