I am trying to run a loop of a couple thousand maps in ArcGIS 10.1 but the program keeps crashing after printing about 100 maps at a time. I read here that I need to make sure my results in Results Management are never saved, so I changed my settings accordingly. While this measure allowed the .mxd file to stay a constant size, it didn't resolve the problem of ArcGIS crashing after printing ~100 maps.
In addition, while I'm in a single ArcGIS session, all results still get written to the Current Session in Results. It seems like the reason ArcGIS ultimately crashes is that too much memory is occupied after the results from ~100 maps are memorized.
I just want to run a single ArcGIS session (never closing the .mxd file while the loop is running) because I have thousands of maps to print and I wouldn't like to open and close the same .mxd file and run the same Python script 20-30 times.
Is there a way I can delete the results from the Current Session at the end of each iteration of my for loop? I was hoping this would prevent ArcGIS from crashing after every 100 maps. Thanks!
In my Python script, I first read in relevant lists of parameters for my loop from a text file. Then I run my one main for loop. In each iteration, I am saving one buffer .shp and one polygon .shp in a workspace:
env.workspace = r"C:\ArcGIS\Mapping Files\All Shapefiles" I then zoom to the buffer layer, export to pdf, and delete the two new layers like so:
for lyr in arcpy.mapping.ListLayers(mxd, "Shape_" + object[i], df): arcpy.mapping.RemoveLayer(df, lyr) for lyr in arcpy.mapping.ListLayers(mxd, "Buffer_" + object[i], df): arcpy.mapping.RemoveLayer(df, lyr) del mxd, df, lyr