I am processing large amounts of images and extract the RGB pixel data to create a hash on it. However there seems to be a weird handle leak in the following code, which I could not trace.
When the code runs, every few minutes the handle count will increase by 1000, eventually leading to a bluescreen on Win7x64 after 20 minutes. Also the amount of memory consumed by the application increases steadily by a hundred MB per minute, GC collection
is not freeing all allocated memory. The following was compiled using VS 2008 as 32 bit app. There are more than 10 threads running in parallel.
public static byte GetImageHash( Bitmap bmp )
using ( MD5 md5 = new MD5CryptoServiceProvider() )
BitmapData data = bmp.LockBits( new Rectangle( Point.Empty, bmp.Size ), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb );
byte rgb = new byte[ data.Width * 3 ];
for ( int i = 0; i < data.Height; ++i )
View Complete Post