gaferrero

DeleteLayer from TOC does not release the memory.

Discussion created by gaferrero on Jul 19, 2011
Latest reply on Dec 9, 2011 by sshetty
Hi All,

I've been trying to delete the layer from the map and release the memory but I was not able to find the solution.

I'm using the following code to remove the layer from the Map.

ILayer layer =  (ILayer) m_mapControl.CustomProperty;            
m_mapControl.Map.DeleteLayer(layer); 


This code is working however the memory is not released.

Does anyone know how can I release the memory? This is a big problem because when I add a lot of layer to the TOC and then I remove them the application does not release the memory.

Outcomes