I am trying to run a loop of a couple thousand maps in ArcGIS Desktop 10.1 but the program keeps crashing after printing about 100 maps at a time. I read at GeoNet 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.

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
  • Can you provide more information on the nature of the processing? Are you saving intermediate products to in-memory geodatabases? Are you deleting intermediate products? Please edit the question (vice answering in comments)
    – Vince
    Oct 13, 2014 at 19:28
  • Can you run your script from ArcCatalog instead? From what you need to do it sounds like you can do all of this (via arcpy) with ArcMap closed.
    – artwork21
    Oct 13, 2014 at 20:42
  • You're removing the layer, but are you removing the data? Are you running out of memory or disk storage?
    – Vince
    Oct 13, 2014 at 21:37
  • Vince, I am not remove the data, only the layer. And I am running out of memory, not disk space. Thank you for asking these clarifying questions!
    – George K
    Oct 13, 2014 at 21:40
  • artwork21: I tried running from ArcCatalog. It didn't work for me, however, because I have some commands such as applying symbology from an existing layer, and it seemed like I had to have my .mxd file open in ArcMap for that.
    – George K
    Oct 13, 2014 at 22:35

1 Answer 1


If you don't already have this set, I would setup the Geoprocessing Options like so:

GP options

Also, you could always programmatically close the ArcMap document and open it up again. You could do this from python or even a .bat script.

From this GeoNet thread, it appears that you can disable logging via arcpy.gp.logHistory = False but it doesn't appear to have any impact. Unsurprisingly, deleting the metadata from C:\Users\<username>\AppData\Roaming\ESRI\Desktop10.0\ArcToolbox\History has no impact either....

  • Thanks, @Paul! You're right , I'm using arcpy.gp.logHistory = False and it did not help. I tried your Geoprocessing Options, but it turns out I do need to check "Add results of geoprocessing operations to the display" because I'm adding buffer layers in each iteration of my loop. Having the settings that you proposed, except for the last red box, did increase my rate of output significantly though. ArcGIS continues to amaze me with its unpredictability.
    – George K
    Oct 14, 2014 at 2:24
  • @GeorgeK, you could just keep the buffer layers with the in_memory workspace and never add them to ArcMap.
    – Paul
    Oct 15, 2014 at 22:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.