[GIS] Clearing map cache – ArcGIS Engine

arcgis-10.0arcgis-engineccache

Is there a programmatic way to clear the cache of a map in ArcGIS Engine 10.0?

It is apparent that there is some caching scheme operating under the covers, and I'd like to clear all of its cached data. To be clear it isn't leaking memory, I just don't want it to be caching anything.

This is a fairly vanilla (*.mxd). Just a raster dataset, no basemap layers or anything fancy going on.

graph of memory

Best Answer

I think you want the IMapCooker2 Interface. It has two methods for clearing caches, Clear and ClearAll.

Clear clears the cache for a given layer within a given extent.

public void Clear (
    ILayer pLayer,
    IEnvelope pExtent
);

ClearAll on the other hand, clears cache for all layers.

public void ClearAll (
);