The GAMS program including the solver can be memory hungry programs for larger models. If Windows has to go to virtual memory (swapping memory to disk) to provide the requested memory the computer often comes to a halt and even killing the GAMS job becomes a major problem. GAMS and the solvers do not distinguish between allocating physical or virtual memory. In case you roughly know the memory demand of your program you can use the following code to determine at the beginning of your GAMS model if you want to continue or not:
$call pmemavail.exe > pmemavail.gms $include pmemavail * Memory minimum in MB $set memmin 4000 $ife %PMEMAVAIL%<%memmin% $abort Not enough physical memory available (available: %PMEMAVAIL% MB, minimum %memmin% MB) * Start the model
You can download the executable of pmemavail.exe and place this into your GAMS directory, so the $call
finds the executable. Here is also the C source:
#include <windows.h> #include <stdio.h> void main() { MEMORYSTATUSEX statex; statex.dwLength = sizeof (statex); GlobalMemoryStatusEx (&statex); printf ("$setglobal PMEMAVAIL %d\n",statex.ullAvailPhys/(1024*1024)); }