Out of memory error when loading a background file

Product(s): WaterCAD, WaterGEMS, HAMMER, StormCAD, SewerCAD, SewerGEMS, CivilStorm, PondPack
Version(s): CONNECT Edition
Area: Layout and Data Input


When loading a background layer an out of memory error is generated.


This issue occurs when there is not enough free memory for the program to process the background file. The reason why it sometimes appears that memory is being limited is due to the fact that the uncompressed file must be allocated a contiguous (unfragmented) block of memory. For example, with 3GB of physical memory available on a 32-bit Operating System, the application has 2GB to work with. Various parts of the program are allocated segments of memory for:

- Model data
- Program code
- Other misc. buffers
- Background file component
- OpenGL graphics component for displaying the image

What's left over and contiguous is what the program can allocate for the uncompressed image, which could potentially be small. To further complicate matters, the memory usage reported by the Windows task manager is not always accurate. See the following article for more: http://www.itwriting.com/dotnetmem.php

Below are some troubleshooting tips for resolving memory issues with large background files:


1) Upgrade to the latest version

The CONNECT Edition release introduces some improvements with regard to memory management of background layers, which may help.

See: Downloading OpenFlows / Hydraulics and Hydrology Software

2) Mr. SID raster files

*.SID raster files are ultra compressed on disk. Unfortunately, the standalone version of the Bentley product needs to uncompress these file to display them. The Mr.SID file may look like it uses only 8 MB of disk space, however, it could be hundreds of MB in memory when uncompressed. Fortunately, *.sid files support the resolution setting in our standalone platform, so you can choose to load at a lower resolution, which is often good enough and will often avoid running out of memory. When opening the file you should be prompted for the resolution in which the file is to be displayed. See item 4 below for more information.

3) Shapefiles

*.SHP files generally are more straightforward in terms of disk space.  This is due to the fact that they contain points, polylines, or polygons, which are represented in the file similarly to how they are represented in memory.  While we do apply other properties when drawing shapefiles that cause us to use some extra memory, it is not as significant an overhead as other file formats can be.  If you are experiencing problems with a shapefile background you may need to break the shapefile into parts and work with one part loaded at a time.

4) DXF files 

 *.DXF files seem to be similar to shapefiles on the surface, but they pose hidden memory problems.  For example, .dxf files can contain more complex geometry such as curves.  These curves are approximated as polylines with a number of intermediate points in the standalone platform.  As a result, much more geometry can be created per entity than exists in the .dxf file itself.  Once again like Shapefiles, if the file is too big one can either remove some complexity from the .dxf file or break up the file into pieces and work with one (or more) sections loaded at a time.

5) Other raster file formats such as (*.bmp, *.jpg, etc.) 

Other raster file formats such as (*.bmp, *.jpg, etc.) can have similar problems.  Some formats are compressed on disk, some are not.  Looking at disk size is not always a good indicator of how much memory is required to load and draw the file in the standalone program.  Additionally, the program needs to load it into a contiguous (unfragmented) block of memory. If many programs had been opened during their windows session, those things may be loaded into random sections of memory, which makes it much more difficult for the program to find a contiguous block of that memory to load the background. If you get an out of memory error with one of these file types and rebooting the computer does not help free up a contiguous block of memory, try opening the file in an image editing program (Photoshop, Paint, GiMP, ...) and lower the resolution/dimensions. For *.JPG files there is a use compression checkbox that you need can select, which should help the image load more efficiently.


Other Options

1) Consider using Bing Maps. The Bing Maps feature enables you to add background imagery from the Bing Maps service and align to your model. This can be more memory efficient compared to using large background image files. See more here: Using Bing Maps as a Background

2) With shapefile and CAD formats, we offer both CAD (WaterCAD/GEMS) and GIS (GEMS only) based platforms that are designed to handle larger background files.  Using the Bentley product in the AutoCAD, MicroStation or ArcGIS platforms can provide more sophisticated methods of handling these large CAD/GIS files and may be a better choice for users who need to work with large dimension backgrounds.

3) Also, if you have not done so already, upgrading to a 64-bit version of the Bentley application and ensuring that you have ample physical RAM installed (8 GB+) will help tremendously, as it will be allowed to access this additional memory when loading the background image. The latest versions of WaterCAD, WaterGEMS, HAMMER, StormCAD, SewerCAD, SewerGEMS and CivilStorm all have a 64-bit version, which will automatically install on a 64-bit operating system. To check if you're using the 64-bit version, open the Bentley product and go to Help > About. If you're using the 64-bit version, you will see an indication in the lower left corner. If you're not using the 64 bit version you can access it by going to the install directory, which is located here by default "C:\Program Files (x86)\Bentley\WaterGEMS\", then opening the 'x64', and double clicking on the WaterGEMS.exe file to launch the program.

4) If you are not able to upgrade to a 64-bit operating system, it is worth noting that some versions of Windows can be configured to use something called 4 Gigabyte Tuning. This allows each 32-bit application to access up to 3GB of RAM, instead of the standard 2GB. This can help if you absolutely must use the 32-bit version of the standalone platform to show your large backgrounds, but is for advanced users. You can read more about 4GT on Microsoft’s website:


5) If you are working off of a server this can also cause issues with loading because the files information is being transferred from that location to your personal computer. If you keep a local copy of the background files and the model files on your computer when you're not in office or connected remotely to the office this might also help resolve the problem.

See Also

Downloading OpenFlows / Hydraulics and Hydrology Software

Long time to load background layers

Background layer causes program to crash

Error message generated when loading background file

Background image quality poor on some computers