I am looping over a quite large feature class (~5million records) While looping using a SearchCursor, I insert new geometries in a FileGeodatabase FeatureClass using arcpy.da.InsertCursor. The inserted geometries are simple poygons (squares). The code works flaylessly for about 2k loops when ArcGIS suddenly crashes. Geometries fed to cursor.InsertRow() before crash are available in target FeatureClass. I felt like this was some kid of buffer issue so I sought for flushing commands but I could not find any in InsertCursor.
What can it be?
********** UPDATE *********
Adding script for clarification. My source FeatureClass is a Point FC with 2 text attributes: 'cellx' and 'celly' My destination FeatureClass isa Polygon FC with geometry plus one text attribute named 'gid'
hc = 0.00833333 # halfcell # Open an InsertCursor toinsert new geometries insertCursor = arcpy.da.InsertCursor('meteogrid_polygon', ['SHAPE@','gid']) i = 1 with arcpy.da.SearchCursor("meteogrid_points_w_gid",['SHAPE@','celly','cellx']) as readCursor: for row in readCursor: point = row.firstPoint x = point.X y = point.Y # Create a square polygon geometry (point(X, Y) around source point array = arcpy.Array([arcpy.Point(x+hc, y+hc),arcpy.Point(x+hc, y-hc),arcpy.Point(x-hc, y-hc),arcpy.Point(x-hc, y+hc)]) polygon = arcpy.Polygon(array) # Create string to put in 'gid' attribute cellname = str(row)+"_"+str(row) # Log to screen for debugging print str(i)+" "+cellname i = i + 1 insertCursor.insertRow([polygon,cellname])