AIMMS Knowledge Base Article – KB000022


Running out of memory



Solving very large problems can result in running out of memory. There are several ways to handle these kind of problems.


When you run your model, the following error message might occur:

        Memory limit exceeded

Other symptoms of reaching the memory limits of your machine can be:

  • It takes a long time to load or save a case,
  • It takes a long time to open a page,
  • AIMMS is running very slow,
  • Your computer is thrashing (excessive swapping), which you can see at the Processes tab of your Task Manager.


AIMMS runs out of memory when you have a very large model (many elements in your identifiers) or a very bad formulated model and the available (virtual) memory is not sufficient.


There are several ways to handle memory problems:

Identifier Cardinalities
In general it is good to have a look at the memory usage of your model during development, even if it doesn’t seem to be a problem for you at the moment. It is possible that it will become a problem when using larger data sets, or that your customer will have problems because they work on computers with less memory. By selecting Identifier Cardinalities from the Tools – Diagnostic Tools menu you can see the memory usage of your identifiers. You can read more about the Identifier Cardinalities tool in the User’s Guide.

For those identifiers that use a lot of memory you should try to decrease the memory usage by:

  • Specify (tight) domain restrictions where possible,
  • Deleting identifiers that were only added for testing purposes,
  • Not saving identifiers in a case that do not need to be saved, using the ‘NoSave’ property, or by specifying and using case types that do not include these identifiers,
  • Using expressions instead of large identifiers on pages that take a long time to open, because then the expressions are only evaluated when necessary. This is especially useful when only a slice of a multi-dimensional identifier is shown.

Proxy Stub solver
Normally AIMMS and the solvers run in the same address space. With the proxy stub interface the solver can run in a separate address space, increasing the memory available to the solver.

To use the proxy stub interface for CPLEX you need to do the steps below (only once). If you want to use another solver, replace CPLEX below by the name of that solver and check which library you need instead of libcpxXX.dll.

  1. Open AIMMS and open the “Solver Configuration” dialog from the “Settings” menu.
  2. Hit the add button and open the “Solver dll” wizard.
  3. Select “libcpxXX_ps.dll”. The solver name shown will be “CPLEX (PS)”.
  4. Make “CPLEX (PS)” the default (for any model type you like).
  5. Set your project options for this new solver.

Increase virtual memory
When following the previous suggestions does not solve your memory problem, you can add virtual memory to your computer. A disadvantage of virtual memory is that your computer needs to swap files from the virtual RAM to the real RAM. This will decrease the performance of your model.

In Windows XP you can add virtual memory through the following steps (in other operating systems it might be slightly different):

  1. Open System in your Control Panel
  2. Go to the Advanced tab
  3. At Performance click on Settings
  4. Go to the Advanced tab
  5. At Virtual memory click on Change
  6. Increase the Maximum Size

Windows 64
If all the other suggestions do not solve the memory problem, you could decide to use a Windows 64 machine instead of Windows 32. This might solve the memory problem, because Windows 64 has large memory support (more RAM and virtual memory). Please check the restrictions and/or adjusted functionality for the AIMMS versions that are available for these Windows 64 platforms.

Add 3GB switch
IMPORTANT: ask your local IT support desk to add the 3GB switch for you.

This switch can only be set in the following operating systems:
Windows XP Professional
Windows Server 2003
Windows Server 2003, Enterprise Edition
Windows Server 2003, Data center Edition
Windows 2000 Advanced Server
Windows 2000 Data center Server
Windows NT Server 4.0, Enterprise Edition
This according to the following Microsoft article

We have tested this on Windows XP professional Service Pack 2. On that OS it can be set in the following way:

  1. In the Windows\Systems32 directory is a tool called “BOOTCFG”. This can be used to change the boot.ini file. This file is a normal text file, but because it is essential in starting the computer, it is not recommended editing this file by hand. The computer might not start correctly after adding this flag. That is why another boot entry needs to be added in the following way:
    BOOTCFG /Copy /D “Microsoft Windows XP Professional 3GB” /ID 1
    More information on this statement can be retrieved in the following way: “BOOTCFG /Copy /?”.
  2. Add the 3GB switch to the copied entry in the following way:
    BOOTCFG /Raw “/3GB” /A /ID 2
    More information on this statement can be retrieved in the following way: “BOOTCFG /raw /?”.
  3. When the computer is restarted the question appears to make a selection between the two entries. There is some time for this (30 seconds by default). This can be made smaller in the following way:
    BOOTCFG /Timeout 5  (5 seconds for example).
  4. To use the 3GB option select the “Microsoft Windows XP Professional 3GB” entry. Now the 3GB can be used for AIMMS.

More information

For more information, please contact us at support@aimms.com.


Last reviewed: 26-11-2014
Applies to: