Hi I have one very strange error when i try compute statistics for my Raster (only happens whit FGDB Raster). It happens when i overwrite raster (when i create new raster everything is OK). Any Ideas? thanks
Dim pRasterCol As IRasterBandCollection pRasterCol = pRaster Dim pBand As IRasterBand pBand = pRasterCol.Item(0) pBand.ComputeStatsAndHist() 'ERROR
ERROR = "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
I create raster like this>
Dim copyRaster As ESRI.ArcGIS.DataManagementTools.CopyRaster = New ESRI.ArcGIS.DataManagementTools.CopyRaster() Dim gp As ESRI.ArcGIS.Geoprocessor.Geoprocessor = New ESRI.ArcGIS.Geoprocessor.Geoprocessor gp.OverwriteOutput = True gp.AddOutputsToMap = False
Hi Martin This common error is related to the object memory not being released. The pRaster object memory should be released before attempting to compute statistics using it. You can use System.Runtime.InteropServices.Marshal.ReleaseCOMObject method to do it.