When using ArcMap versions 10.5.x or later, ArcMap either crashes while attempting to open, or after opening an existing map document (.mxd) that contains map services.
ArcMap may crash when switching between tabs in the Table Of Contents, adding other layers, editing features, changing a layer's visibility, using the Field Calculator, or running a geoprocessing tool. Additionally, the amount of time that passes before the application crashes depends on the layers or geoprocessing tools used after opening the .mxd.
Because an application may crash for a variety of reasons, this technical article provides suggestions that can help determine if the cause of the crash is related to system limitations.
Most crashes are related to the number of Graphical Device Interface (GDI) objects exceeding application limitations. This is most common in situations where map services are added to the MXD, as these may contain tens or hundreds of legend items with multiple symbol classes.
In Windows XP and later, the system-wide limit is 216, or 65,536 GDI objects. This is managed by the OS by limiting the object count between open applications; ArcMap is limited to 10,000 GDI objects. The number of GDI objects ArcMap is consuming can be viewed any time through the Task Manager:
For example, the GDI object count increases when opening an MXD, adding layers to the MXD, switching between tabs in the Table Of Contents, or displaying legend items. If the MXD contains a map service, or if a map service is added to ArcMap, this further increases the GDI object count if the map service contains a large number of layers.
As a precaution, ArcMap does not display more than 100 legend items per map service layer, but this does not account for the situation where hundreds of map service layers each contain less than 100 legend items. Even though ArcMap may not crash at the time of adding the map service layers, navigating around ArcMap or performing analysis on layers in the map may result in exceeding the 10,000 GDI object limit.
Use one or more of the following solutions, if applicable, to resolve any application crash issues when working with map services in ArcMap.
<drive>\Program Files (x86)\ArcGIS\Desktop10.x\Utilities\AdvancedArcMapSettings.exeFollow the instructions below to modify the number of map service layer legend items that ArcMap is allowed to draw.