You should release the feature objects you're using inside the loop in each loop iteration. The ones I see are fSource, fTargetNew and f (at least it looks like f is a feature object). Call ReleaseComObject on these feature objects inside the loop just as soon as you're done with them just like you do for cursor objects.
Can you provide details on how many features get added or updated before you get this error? Also are you using recycling cursor or non-recycling cursor?Try releasing cursor after 40,000 or 50,000 iterations and see if that makes any difference.Cheers!!Sumit
Can you post the code for import features? Also, Did you monitor the memory usage in taskmgr while running insert features?
// // Initiate: IFeatureclass fcSource = .. IFeatureClass fcTarget = ... IWorspaceEdit wsTarget = ... List sourceIdList = ... // // Start transaction: wsTarget.StartEditing(false); wsTarget.StartEditOperation(); // // Do import: foreach(int sourceOid in sourceIdList) { IFeature fSource = fcSource.GetFeature(sourceOid); ... int a = fSource.get_value(..); int b = fSource.get_value(...); // // Examine values in target fc if necessary: if(boundsHaveChanged) { String whereRestriction = "(a>"+a.ToString() + ") and (b<"+b.ToString()+")"; IQueryFilter qf = new QueryFilterClass(); qf.WhereClause = whereRestriction; qf.AddField(fieldName); IFeatureCursor fcur = fl.FeatureClass.Search(qf, false); IDataStatistics dstat = new DataStatisticsClass(); dstat.Cursor = (ICursor)fcur; dstat.Field = fieldName; IStatisticsResults res = dstat.Statistics; int maxFound = System.Convert.ToInt32(res.Maximum); ... Marshal.ReleaseComObject(fcur); Marshal.ReleaseComObject(dstat); } IFeature fTargetNew = fcTarget.CreateFeature(); IPoint p = new PointClass(); ... fTargetNew.Shape = p; ... fTargetNew.set_value(i, f.get_value(j) ); ... fTargetNew.Store(); } wsTarget.StopEditOperation(); wsTarget.StopEditing(true); ...
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.