Below script is very standard for running any geoprocessing tool using ArcObjects but it hardly releases memory. It is helping the tool crashes after processing few 100 datasets. Please help in this regard. Thanks in advance.
geoprocessor.ClearMessages();
// Set the overwrite output option to true
geoprocessor.OverwriteOutput = true;
try
{
Logger.Write("RunTool is started", "AppLog");
// Execute the tool
geoprocessor.Execute(process, null);
ReturnMessages(geoprocessor);
ESRI.ArcGIS.ADF.ComReleaser.ReleaseCOMObject(geoprocessor);
ESRI.ArcGIS.ADF.ComReleaser.ReleaseCOMObject(process);
geoprocessor = null;
process = null;
}
catch (Exception ex)
{
Logger.Write("Exception in RunTool::"+ex.Message, "ExceptionHandling");
ReturnMessages(geoprocessor);
}