标签:div oid var ring pre get mono == span
public class testGC : MonoBehaviour { class XDict<K, V> { public void TryGetValue(K key, V value) { if(key == null) //产生 GC-ALLOC,因为实参为int,而 null是引用类型,发生了装箱操作 { } } } XDict<int, string> mDict = new XDict<int, string>(); void Start() { } void Update() { var key = 10; if (key != null) //不会产生GC-ALLOC { var value = 20; } mDict.TryGetValue(10, "hello"); } }
标签:div oid var ring pre get mono == span
原文地址:https://www.cnblogs.com/timeObjserver/p/10394862.html