public void Tick() { if (_poolListDirty) { _poolListDirty = false; _pools.Clear(); _pools.AddRange(StaticMemoryPoolRegistry.Pools.Where(ShouldIncludePool)); } InPlaceStableSort <IMemoryPool> .Sort(_pools, ComparePools); }
public void Tick() { if (_poolListDirty) { _poolListDirty = false; _pools.Clear(); using (var i = StaticMemoryPoolRegistry.Pools.GetEnumerator()) while (i.MoveNext()) { if (!i.Current.TryGetTarget(out var pool) || !ShouldIncludePool(pool)) { continue; } _pools.Add(i.Current); } //_pools.AddRange(StaticMemoryPoolRegistry.Pools.Where(ShouldIncludePool)); } InPlaceStableSort <WeakReference <IMemoryPool> > .Sort(_pools, ComparePools); }