[GIS] Out of memory when running ModelBuilder

arcgis-10.3arcgis-desktopin-memorymemorymodelbuilder

I'm currently using ArcGIS 10.3.1 on a 64 bit windows 7 machine.

When I run the following model, every iteration adds about 20 consistent megabytes into the ArcMap sessions memory until it eventually runs out.

I've tried adding a 'delete' function for in_memory. The output shows this works, but the 20 megabytes still keeps adding up.

It's the same thing that happens if you do several processes in ArcMap and eventually the memory gets used up, even if you're not storing extra datasets in the project.

Any ideas on how to eliminate this problem so the memory won't run out?

Model

HERE'S THE OUTPUT REPORTING RESULTS:

Executing (Iterate Field Values): IterateFieldValues
C:\Projects\Yakima_Basin_Study_0410\KtoKPipeline_KachessInactive\Kachess_Capacity_Table_Contours\Kachess_Capacity_1015\Kachess_Capacity_1015.gdb\IterationTable0316
Iteration Double true false 0 Start Time: Wed Mar 30 06:24:39 2016
Succeeded at Wed Mar 30 06:24:39 2016 (Elapsed Time: 0.19 seconds)
Executing (Surface Volume): SurfaceVolume
C:\Projects\Yakima_Basin_Study_0410\KtoKPipeline_KachessInactive\Kachess_Capacity_Table_Contours\Kachess_Capacity_1015\TIN_KACDam_BORDatum_0316
C:\Projects\Yakima_Basin_Study_0410\KtoKPipeline_KachessInactive\Kachess_Capacity_Table_Contours\Kachess_Capacity_1015\Kachess_Capacity_Output_Files\KACDam.txt
BELOW 2133.01 1 0 Start Time: Wed Mar 30 06:24:43 2016 Completed
Surface Volume: 2D Area=117053561.15555 3D Area=132153865.43817
Volume=19787611237.973 Succeeded at Wed Mar 30 06:25:02 2016 (Elapsed
Time: 19.57 seconds) Executing (Delete): Delete in_memory Workspace
Start Time: Wed Mar 30 06:25:12 2016 Succeeded at Wed Mar 30 06:25:12
2016 (Elapsed Time: 0.01 seconds) Executing (Iterate Field Values):
IterateFieldValues
C:\Projects\Yakima_Basin_Study_0410\KtoKPipeline_KachessInactive\Kachess_Capacity_Table_Contours\Kachess_Capacity_1015\Kachess_Capacity_1015.gdb\IterationTable0316
Iteration Double true false 0 Start Time: Wed Mar 30 06:25:12 2016
Succeeded at Wed Mar 30 06:25:12 2016 (Elapsed Time: 0.02 seconds)
Executing (Surface Volume): SurfaceVolume
C:\Projects\Yakima_Basin_Study_0410\KtoKPipeline_KachessInactive\Kachess_Capacity_Table_Contours\Kachess_Capacity_1015\TIN_KACDam_BORDatum_0316
C:\Projects\Yakima_Basin_Study_0410\KtoKPipeline_KachessInactive\Kachess_Capacity_Table_Contours\Kachess_Capacity_1015\Kachess_Capacity_Output_Files\KACDam.txt
BELOW 2133.02 1 0 Start Time: Wed Mar 30 06:25:14 2016 Completed
Surface Volume: 2D Area=117057436.47809 3D Area=132158168.43332
Volume=19788781792.957 Succeeded at Wed Mar 30 06:25:27 2016 (Elapsed
Time: 12.63 seconds) Executing (Delete): Delete in_memory Workspace
Start Time: Wed Mar 30 06:25:37 2016 Succeeded at Wed Mar 30 06:25:37
2016 (Elapsed Time: 0.01 seconds) Executing (Iterate Field Values):
IterateFieldValues
C:\Projects\Yakima_Basin_Study_0410\KtoKPipeline_KachessInactive\Kachess_Capacity_Table_Contours\Kachess_Capacity_1015\Kachess_Capacity_1015.gdb\IterationTable0316
Iteration Double true false 0 Start Time: Wed Mar 30 06:25:37 2016
Succeeded at Wed Mar 30 06:25:37 2016 (Elapsed Time: 0.02 seconds)

Best Answer

Enabling 64 bit background geoprocessing seems to have solved the issue. It's not due to allowing more RAM to be comsumed than in a 32 bit ArcMap session.

The original problem was that one iteration of the model would use around 700 mb of memory, then release around 680 mb, leaving 20 mb as just dead memory (used but not actively doing anything). With each iteration this 20 mb would add up until the limit was exceeded.

Using the 64 bit background geoprocessing seems to release all the memory at the end of each iteration, therefore it never comes close to exceeding the overall limit.

For people, like me, who just use model builder occasionally here's a few basic steps to enable your model to run in the background 64 bit environment: 1) Go to the 'geoprocessing' drop down list> Pick 'geoprocessing options'> Click 'enable' for background processing. 2) Right click on your model> Select 'properties'> On the 'general' tab click off 'always run in foreground' 3) Right click each element of your model> Choose 'model parameter' if it allows you to. 4) Run your model as a tool by double clicking on it. Do not run it in edit mode.

I never finished trying the use of arcpy.Delete_management("in_memory") in a python code, since the 64 bit background geoprocessing worked. I would guess running the model as a python script with this suggestion would probably have worked if using the 64 bit geoprocessing or if it was run outside of the ArcMap GUI.

Thanks for everyones suggestions.

Related Question