From fecaa6e946fc87df28682c96fea67c1535825cd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lourens=20Naud=C3=A9?= Date: Tue, 22 Oct 2019 00:03:05 +0100 Subject: [PATCH] Let the backtrace array constructed in backtrace_collect be initialized with the size already given --- vm_backtrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vm_backtrace.c b/vm_backtrace.c index b04f6dac31..5b79e3d274 100644 --- a/vm_backtrace.c +++ b/vm_backtrace.c @@ -578,7 +578,7 @@ backtrace_collect(rb_backtrace_t *bt, long lev, long n, VALUE (*func)(rb_backtra rb_bug("backtrace_collect: unreachable"); } - btary = rb_ary_new(); + btary = rb_ary_new2(n); for (i=0; i+levbacktrace_size && ibacktrace[bt->backtrace_size - 1 - (lev+i)];