Meta
Categories
Category Archives: c#
Fix Image.FromHbitmap(hBitmap) Memory Leak
Don’t forget to clean up after using Image img = Image.FromHbitmap(hBitmap) or you will experience serious memory leaks. Image img = null; try { img = Image.FromHbitmap(hBitmap); }finally{ DeleteObject(hBitmap); img.Dispose(); } [DllImport("gdi32.dll", EntryPoint = "DeleteObject")] public static extern IntPtr … Continue reading
Posted in c#
Leave a comment