/// <summary> /// Removes an <see cref="ILargeObjectContainer"/> from the memory manager's list. /// </summary> public static void Remove(ILargeObjectContainer container) { lock (_syncLock) { _containersToAdd.Remove(container); _containersToRemove.Add(container); } }
/// <summary> /// Removes an <see cref="ILargeObjectContainer"/> from the memory manager's list. /// </summary> public static void Remove(ILargeObjectContainer container) { // CR (JY 2013-APR-15): Assert container != null lock (_syncLock) { _containersToAdd.Remove(container); if (!_containersToRemove.Contains(container)) { _containersToRemove.Add(container); } } }
/// <summary> /// Adds an <see cref="ILargeObjectContainer"/> to the memory manager's list. /// </summary> public static void Add(ILargeObjectContainer container) { #if UNIT_TESTS if (!Enabled) { return; } #endif // CR (JY 2013-APR-15): Assert container != null lock (_syncLock) { _containersToRemove.Remove(container); _containersToAdd.Add(container); StartCollectionThread(); } }
/// <summary> /// Adds an <see cref="ILargeObjectContainer"/> to the memory manager's list. /// </summary> public static void Add(ILargeObjectContainer container) { #if UNIT_TESTS if (!Enabled) { return; } #endif lock (_syncLock) { _containersToRemove.Remove(container); if (!_containersToAdd.Contains(container)) { _containersToAdd.Add(container); } StartCollectionThread(); } }
private IEnumerable <ILargeObjectContainer> GetNextBatchOfContainersToCollect(int batchSize) { int i = 0; while (_regenerationCost <= RegenerationCost.High) { bool timeGreaterThanOrEqualToZero = true; while (timeGreaterThanOrEqualToZero) { while (_largeObjectEnumerator.MoveNext()) { ILargeObjectContainer container = _largeObjectEnumerator.Current; if (!container.IsLocked && container.RegenerationCost == _regenerationCost) { TimeSpan timeSinceLastAccess = _collectionStartTime - container.LastAccessTime; if (timeSinceLastAccess >= _maxTimeSinceLastAccess) { yield return(container); if (++i == batchSize) { yield break; } } } } _largeObjectEnumerator.Reset(); // check this before doing the decrement for the odd case where the decrement takes // the time slightly past zero when it should be exactly zero. timeGreaterThanOrEqualToZero = _maxTimeSinceLastAccess >= TimeSpan.Zero; _maxTimeSinceLastAccess -= _maxTimeSinceLastAccessDecrement; } _maxTimeSinceLastAccess = _timeSinceLastCollection; ++_regenerationCost; } }
private static void Unload(ILargeObjectContainer loc) { loc.Unload(); }
public Item(ILargeObjectContainer container) { _reference = new WeakReference(container); }