From 7849416d3298a9e269f87854d4083ee4390a6578 Mon Sep 17 00:00:00 2001 From: Marko Lahma Date: Mon, 4 Nov 2024 18:03:54 +0200 Subject: [PATCH] Use Array.Resize when growing ArrayInstance (#1997) --- Jint/Native/Array/ArrayInstance.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Jint/Native/Array/ArrayInstance.cs b/Jint/Native/Array/ArrayInstance.cs index 7115d1ca4..a16eef472 100644 --- a/Jint/Native/Array/ArrayInstance.cs +++ b/Jint/Native/Array/ArrayInstance.cs @@ -951,9 +951,7 @@ internal void EnsureCapacity(uint capacity, bool force = false) } // need to grow - var newArray = new JsValue[capacity]; - System.Array.Copy(dense, newArray, dense.Length); - _dense = newArray; + System.Array.Resize(ref _dense, (int) capacity); } public JsValue[] ToArray()