Error: Out of Memory" error occurs during a closest facility solve
While solving a large closest facility, the following error message is returned:
“Error: Out of memory”.
As Network Analyst solves an analysis, it compiles and temporarily stores intermediate information in memory. This information is referenced near the end of the solve process to find a solution. Once the solve process is completed, the information is cleared from memory.
This out-of-memory error message appears when the space available in the system’s memory is depleted before Network Analyst has finished storing all the necessary intermediate information.
Solution or Workaround
One workaround is to solve the same network analysis on another computer that has more memory. Still, the analysis may be too large for that computer as well, or another computer may not be accessible. If either of these is the case, another possible workaround is to use 'chunking'. To enable chunking, change the registry key values so that Network Analyst breaks the analysis into smaller problems or 'chunks' and clears out the memory after solving each chunk.
Keep in mind that traversal results are not generated when chunking is applied. A traversal result is a list of the source features that were traversed during a network analysis. It is required to generate directions and to perform some other post-processes. Some functions in the ArcGIS Schematics extension, for example, require a traversal result as input. When chunking is used, it is unlikely that directions can be generated or post-processes can be performed after solving an analysis.
If a closest facility problem is being solved and the “Error: Out of memory” error message is being returned, consider using the OD cost matrix solver. The closest facility and OD cost matrix solvers perform similar tasks. The main differences are that closest facility can generate directions and output the true shape of routes between facilities and incidents. The OD cost matrix solver cannot generate directions, and the only lines it can produce are straight lines that directly connect origins and destinations. The closest facility solver is able to do more because it stores a traversal result, but that requires more memory and time to create. Therefore, if directions do not need to be generated or traversal results or the true shape of the routes do not need to be stored, try solving the same problem using OD cost matrix.
The instructions below include making changes to essential parts of your operating system. It is recommended that you backup your operating system and files, including the registry, before proceeding. Consult with a qualified computer systems professional, if necessary.
Esri cannot guarantee results from incorrect modifications while following these instructions; therefore, use caution and proceed at your own risk.
Instructions provided describe how to configure chunking for closest facility layers.
- Open the Registry Editor.
▪ In Windows XP, click Start > Run, type regedit, and click OK.
▪ In Windows 7 or Vista, click Start, type regedit in the search text box, and press 'Enter'.
- Expand the following keys, which look like folders: HKEY_CURRENT_USER > Software > ESRI
- For ArcGIS 10 or a later release, expand the Desktop <version number> key.
▪ For example, at ArcGIS 10, expand Desktop 10.0.
- Click the NetworkAnalyst key.
▪ If the NetworkAnalyst key does not exist, create a key by right-clicking on the key that is one level above (ESRI or Desktop <version number>) and click New > Key. Rename the new key NetworkAnalyst.
▪ Several steps below require the creation of a key in the registry. To do that follow the same procedure that was just used; meaning, right-click the key in which to create the new key and select New > Key. Rename the new key to match the name given in the Step 4.
- In the NetworkAnalyst key, create a key named ClosestFacility, if it does not already exist.
- Double-click ClosestFacility.
- In the ClosestFacility key, look for the DWORD key value named ForceChunking. Create it if it does not already exist.
▪ To create the key value, right-click ClosestFacility and click New > DWORD Value. Rename the value ForceChunking.
- Double-click ForceChunking to open the Edit DWORD Value dialog box.
- In the Edit DWORD Value dialog box, click Decimal and enter an integer in the Value data text box.
▪ Network Analyst looks at this ForceChunking key value to determine whether it should apply chunking during a closest facility solve process. A value of 0 (zero) indicates that chunking should not be applied. Any non-zero value indicates chunking should be applied. The number 1 could be entered, for example, to turn chunking on.
- In the ClosestFacility key, look for the DWORD key value named FacilityChunkSize. Create it if it does not already exist.
▪ To create the key value, right-click ClosestFacility and click New > DWORD Value. Rename the value FacilityChunkSize.
- Double-click FacilityChunkSize to open the Edit DWORD Value dialog box.
- In the Edit DWORD Value dialog box, click Decimal and enter an integer between one and 1000 in the Value data text box.
▪ The value that is entered here determines the maximum number of facilities to search for at each step of the solve process when solving using a hierarchy. By default, Network Analyst searches simultaneously for 500 facilities. By entering a value that is less than 500, the maximum memory requirement is reduced, but the solve time may increase.
- In the ClosestFacility key, look for the DWORD key value named IncidentChunkSize. Create it if it does not already exist.
▪ To create the key value, right-click ODCostMatrix and click New > DWORD Value. Rename the value IncidentChunkSize.
- Double-click IncidentChunkSize to open the Edit DWORD Value dialog box.
- In the Edit DWORD Value dialog box, click Decimal and enter an integer between one and 500 in the Value data text box.
▪ The value that is entered here determines the maximum number of incidents to search for at each step of the solve process when solving without using a hierarchy. By default, Network Analyst searches for 500 incidents. By entering a value that is less than 500, the maximum memory requirement is reduced, but the solve time may increase.
- Solve the closest facility analysis layer in ArcMap.
- Delete the key values that were created in the steps above.
▪ The only way to determine whether chunking is enabled is by looking in the registry for the key values mentioned above. Therefore, to ensure that chunking is not being used in any future analysis, once the analysis is complete, delete the key values that were just created.