protected override void OnDestroy() { // Destroying all cached textures, since they're only used inside this ScrollView, which is now being destroyed. // Not doing this would cause memory leaks _ImagesPool.Clear(); base.OnDestroy(); }
public void EmptyPool_Test() { FillPool(); _pool.Clear(); var positions = PoolPositionUtility.GetAllIndices(); Assert.IsTrue(_pool.Size() == 0); foreach (var i in positions) { Assert.AreEqual(null, _pool.GetCardAt(i)); } }
public void Clear() { foreach (var entity in entityCache.GetAlive() .Concat(entityCache.GetAwaitingActivation()) .Concat(entityCache.GetAwaitingDeactivation()) .Concat(entityCache.GetZombies())) { OnDestroy?.Invoke(this, new EntityEventArgs() { Entity = entity }); entity.Destroy(); } entityCache.Clear(); entityAttributes.Clear(); entityComponents.Clear(); entityIdPool.Clear(); }
public void CleanCached() { for (int i = Count - 1; i >= 0; --i) { var it = this[i]; //将弱引用转换为强引用才可以使用,相当于lock IPool pool = it.Target as IPool; if (null != pool) { //void } else { RemoveAt(i); continue; } pool.Clear(); if (pool.RemoveWhenAutoCleanup) { RemoveAt(i); } //if } //for } //CleanCached
/// <summary> /// Clears the underlying pool of all its connections /// </summary> public void Clear() { _pool.Clear(); }