When getting the Out of (Global) Memory error while importing/exporting an image file or saving an SRF file, this is generally because your computer is truly out of memory. There are a couple things to know when dealing with this error or overall slow performance:
- You can use the 64-bit version of Surfer. The 64-bit version of Surfer is able to access more memory than 32-bit versions of Surfer.
- You can estimate the amount of RAM you will need on your computer to import/export an image by looking at the size of the image in pixels. Surfer treats all images as uncompressed images. The amount of memory required for each image file is:
width in pixels * height in pixels * 3 (color depth) * 2
You will need at least this much available memory to import/export the image or save an SRF file with this image in it. You may be able to reduce the memory requirements by resizing the image to a smaller number of pixels.
- The 32-bit versions of Surfer are limited to the Windows maximum amount of memory. The maximum amount of memory that Windows can allocate to a 32-bit program is 2 GB. In addition, Windows typically reserves half the RAM for the operating system, so the available memory can be much less, regardless of the amount of RAM and size of your swap file. For example, if you have 2 GB of RAM, only a maximum of 1 GB can be used for Surfer.
In addition, Surfer 32-bit uses about 10 MB of memory just to start up, and additional memory for each object and operation. When changes are made to an object, the amount of memory used doubles temporarily. Based on these assumptions, the maximum size of an uncompressed image file to import or export is about 990 MB. This is also about the largest SRF file we've been able to save. As in #1 above, you can try the 64-bit version of Surfer.
- Surfer requires a contiguous block of memory. The computer may have enough free available memory to save/import/export the file, but if it is fragmented over several blocks, then Surfer can only use the largest block of memory available. If you believe you have enough RAM to import or export the image or save the SRF file, reboot the computer to defragment the memory, close down as many running applications as possible, and then try to import/save/export the image.
- Surfer may be holding memory for the number of Undo levels you have set for Surfer. If you have the number of Undo levels set to 15, then Surfer has to hold the necessary memory to be able to undo the previous 15 actions. If they are actions that take a lot of memory (ie. sorting a large data set, creating a map from a large GRD, etc), then Surfer has to hold onto the same amount of memory it took to perform the actions so it can undo them. Restarting Surfer resets the Undo actions so Surfer can release the memory it was holding. Another option is to set the number of Undo levels to 0 or some other smaller number, so Surfer can release some more memory. You can set the number of Undo levels by going to File | Options.
Updated November, 2021