概要
using UnityEngine; public class Example : MonoBehaviour { private void Update() { // GC Alloc が 31.2 KB for ( var i = 0; i < 1000; i++ ) { var strings = new string[ 0 ]; } } }
using System; using UnityEngine; public class Example : MonoBehaviour { private void Update() { // GC Alloc が 0 KB for ( var i = 0; i < 1000; i++ ) { var strings = Array.Empty<string>(); } } }