Consider the following code throws an exception 'MILERR_WIN32ERROR':
while(true)
{
System.Windows.Media.Imaging.WriteableBitmap writableBitMap =
new System.Windows.Media.Imaging.WriteableBitmap(100, 200, 96, 96, System.Windows.Media.PixelFormats.Bgra32, null);
}
WriteableBitmap does not implement IDisposable, I'm not sure why the memory leak is happening at all (the original code I had was much more complicated and I tracked it down to this).
The memory leak issue is derived from memory leak of BitmapSource. Googling around that will find you better results :)
This says that you should assign writableBitMap to 'null' once you have used it. I would say try using Freeze() method before assigning it to null and then try. If after that, if you see memory leak persist, disable the caching option (CacheOption) by setting it to BitmapCacheOption.OnLoad.