Steve,
Thanks for your post, I did a simple test just for one ECWRasterLayer, but I didn't find out any memory leak problem, I tested the World.ecw file, here is my test code below to check the current memory when loading ecw file and after closing the ecw file:
EcwRasterLayer ecwLayer = winformsMap1.FindRasterLayer("EcwImageLayer") as EcwRasterLayer;
string procNameBefore = Process.GetCurrentProcess().ProcessName;
Process currentProcessBefore = Process.GetCurrentProcess();
string currentMemory = string.Format("{0} KB", currentProcessBefore.PrivateMemorySize64 / 1024);
MessageBox.Show(string.Format("Before close, {0} process's memory is:{1}KB", procNameBefore, currentMemory));
ecwLayer.Close();
string procNameClose = Process.GetCurrentProcess().ProcessName;
Process currentProcessClose = Process.GetCurrentProcess();
currentMemory = string.Format("{0} KB", currentProcessClose.PrivateMemorySize64 / 1024);
MessageBox.Show(string.Format("After close, {0} process's memory is:{1}KB", procNameClose, currentMemory));
Also I attached the screen shots for my tests below:
Loaded ecw file, before close it:
After close it:
You can see the memory was released properly from the screen shots above, so can you check your application again to make sure the OutOfMemory exception was not caused by any other places.
Thanks,
Scott,