Raven.Database.Indexing.BaseBatchSizeAutoTuner.OutOfMemoryExceptionHappened C# (CSharp) Method

OutOfMemoryExceptionHappened() public method

This let us know that an OOME has happened, and we need to be much more conservative with regards to how fast we can grow memory.
public OutOfMemoryExceptionHappened ( ) : void
return void
		public void OutOfMemoryExceptionHappened()
		{
			// first thing to do, reset the number of items per batch
			NumberOfItemsToIndexInSingleBatch = InitialNumberOfItems;

			// now, we need to be more conservative about how we are increasing memory usage, so instead of increasing
			// every time we hit the limit twice, we will increase every time we hit it three times, then 5, 9, etc

			LastAmountOfItemsToRemember *= 2;
		}

Usage Example

Example #1
0
        private void HandleOutOfMemoryException(OutOfMemoryException oome)
        {
            log.WarnException(
                @"Failed to execute indexing because of an out of memory exception. Will force a full GC cycle and then become more conservative with regards to memory",
                oome);

            // On the face of it, this is stupid, because OOME will not be thrown if the GC could release
            // memory, but we are actually aware that during indexing, the GC couldn't find garbage to clean,
            // but in here, we are AFTER the index was done, so there is likely to be a lot of garbage.
            GC.Collect(GC.MaxGeneration);
            autoTuner.OutOfMemoryExceptionHappened();
        }
All Usage Examples Of Raven.Database.Indexing.BaseBatchSizeAutoTuner::OutOfMemoryExceptionHappened