Limiting memory use with HeapLimit

Top  Previous  Next

Cases may arise where one needs to limit the amount of memory a GAMS job can use. The HeapLimit GAMS parameter and function permits this to be done during GAMS compilation and execution, but does not limit memory use during solver execution (i.e. not during CONOPT or CPLEX etc.).  It limits memory use to a given number of MegaBytes. If the data storage exceeds this limit, the job will be terminated with return code 10, out of memory. These features may be especially useful in a server environment.   This is accomplished in one of two ways.  Namely through

The GAMS parameter HeapLimit sets the limit of memory use at compile and execution time for a GAMS job.
The function/property HeapLimit can be used to interrogate the current limit and allows it to be reset.

Note the NLP solver CONOPT also has a HeapLimit option which ensures that the solver will not use more dynamic memory than allowed.