Skip to content

Commit

Permalink
Use Array.Resize when growing ArrayInstance (#1997)
Browse files Browse the repository at this point in the history
  • Loading branch information
lahma authored Nov 4, 2024
1 parent 44a0ce0 commit 7849416
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions Jint/Native/Array/ArrayInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 7849416

Please sign in to comment.