AnsweredAssumed Answered

memory leaks - ArcMap - query / selection with spatial filter - selectionset

Question asked by t_joseph833 on May 18, 2012
Latest reply on Jun 7, 2012 by t_joseph833
Hi, anyone come across memory leaks in ArcMap running selectionset search. Feature cursors are released using System.Runtime.InteropServices.Marshal.FinalReleaseComObject


                pSpatialFilter = New ESRI.ArcGIS.Geodatabase.SpatialFilterClass()
                With pSpatialFilter
                    .Geometry = pPoint
                    .GeometryField = m_pFeatureClass.ShapeFieldName
                    .SpatialRel = ESRI.ArcGIS.Geodatabase.esriSpatialRelEnum.esriSpatialRelIntersects
                End With

               pSelectionSet.Search(pSpatialFilter, False, pFeatureCursor)


If looping thousands of features ... memory in ArcMap.exe process in Task Manager keeps growing until ArcMap crashes. This only happends with SQL Server Express ... running the same code with Personal gdb (MS Access) has no leaks. Not sure how to release the selectionset explicitly.

Any help or ideas much appreciated.

Outcomes