I'm getting some errors trying to do a search on a feature class. The first search always works but the second search seems to fail 80% of the time and its typically a crash on line "pFC4 = streetSegFC2.Search(pSF4, True)". Im assuming it crashes instead of being caught because of an "out of memory" error. I'm realeasing the first cursor the best I can in every way i know how to but it seems to still be holding onto the cursor in memory. Originally I was using the same featureclass to search from but I decided to create a separate instance of the featureclass and that didn't help. I tried creating a completely separate workspace to create the second featureclass from which triggered a completely separate SDE stream/connection but it still fails. Any ideas on what to do if the cursors or memory aren't being fully released? The 2 searches below are virtually identical and hitting the same database featureclass.Thanks, Gary
pSF = New SpatialFilterClass()
pcomReleaser.ManageLifetime(pSF)
pSF.Geometry = pTopo.Buffer(bufTol)
pSF.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects
pSF.WhereClause = "FULLSTNAME='MAIN ST'"
Try
pFC = streetSegFC.Search(pSF, True)
pcomReleaser.ManageLifetime(pFC)
pF = pFC.NextFeature
If pF Is Nothing Then
Log.Log(LogLevel.DetailedInfo, "No streets found", _logFileName)
Return Nothing
End If
Catch ex As Exception
Log.Log(LogLevel.Exception, ex.Message & vbCrLf & ex.StackTrace, _logFileName)
Finally
pcomReleaser.dispose()
Common.Release(pFC)
pFC = Nothing
End Try
....
Some code
....
pSF4 = New SpatialFilterClass()
pcomReleaser.ManageLifetime(pSF4)
pSF4.Geometry = pTopo2.Buffer(bufTol)
pSF4.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects
pSF4.WhereClause = "FULLSTNAME='MAIN ST'"
Try
pFC4 = streetSegFC2.Search(pSF4, True)
pcomReleaser.ManageLifetime(pFC4)
pF4 = pFC4.NextFeature
If pF4 Is Nothing Then
Log.Log(LogLevel.DetailedInfo, "No streets found", _logFileName)
Return Nothing
End If
Catch ex As Exception
Log.Log(LogLevel.Exception, ex.Message & vbCrLf & ex.StackTrace, _logFileName)
Finally
pcomReleaser.dispose()
Common.Release(pFC4)
pFC4 = Nothing
End Try