I'm trying to load a lot of images and I get an OutOfMemory exception. That is fine and I catch it but I want to handle the problem and continue. I need to free the memory but can't see how.
I iterated over all the images (ECWRasterLayer) in my image overlay and closed them then cleared the layers from the overlay. This did not release the memory.
I then tried to refresh the map passing the image overlay but this throws another OutofMemory exception.
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:
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.