internal void UpdateEstimatedSize(long estimatedSize) { if (_gcPressure != null) { _gcPressure.Release(); } // // estimatedSize may be 0 for small images with fewer than 8 bits per pixel, // attempting to call GC.AddMemoryPressure with a pressure of 0 will cause it to // throw, so don't add memory pressure if estimatedSize is 0. // if (estimatedSize > 0) { _gcPressure = new SafeMILHandleMemoryPressure(estimatedSize); _gcPressure.AddRef(); } }