This repository was archived by the owner on Mar 30, 2019. It is now read-only.
This repository was archived by the owner on Mar 30, 2019. It is now read-only.
How to dispose bitmap #878
Open
Description
public D2D.Bitmap LoadBitmapFromFile(String filename,int frameIndex = 0)
{
D2D.Bitmap bitmap = null;
NativeFileStream fileStream = new NativeFileStream(filename, NativeFileMode.Open, NativeFileAccess.Read);
BitmapDecoder bitmapDecoder = new BitmapDecoder(_imagingFactory, fileStream, DecodeOptions.CacheOnDemand);
BitmapFrameDecode frame = bitmapDecoder.GetFrame(0);
FormatConverter converter = new FormatConverter(_imagingFactory);
converter.Initialize(frame, SharpDX.WIC.PixelFormat.Format32bppPRGBA);
bitmap = SharpDX.Direct2D1.Bitmap1.FromWicBitmap(_renderTarget, converter);
return bitmap;
}
When I load bitmap from file continuous using this code ,memory increase all the time . [Bitmap object] dispose function have no effect, [GC.Collect] have no effect also.This [Bitmap object] how to dispose.Help me please.