4.48. "Out of Memory"

When I perform some operation, I get an "out of memory" error. What causes this, and what can I do about it?

Running programs often need more memory than you have in your computer. To meet this need, Windows uses disk space dynamically as "virtual memory", also called the "paging file". Many applications, including @RISK, also write files to your hard drive during operation. For instance, @RISK stores all simulation data in a temporary file for use when generating reports.

"Out of memory" can indicate an actual out of memory condition, or running out of resources such as disk space. Windows and your applications run better when your disk has elbow room — you can get "out of memory" long before you're down to the last megabyte of free disk space. "Out of memory" can also indicate that one or more worksheets in the workbook are protected.

The following apply only to @RISK. For instance, "Out of Memory" might appear when you open a simulation data window after a large simulation, or do something else that takes significant system resources.

Special note: Even if you're not getting the "out of memory" error, you may be able to speed up your @RISK simulation with the techniques in this article.

Collecting Input Distributions

The @RISK default is to collect all inputs. If you don't actually need to record the value of every input, go into Simulation Settings and on the Sampling tab, in the section titled Collect Distribution Samples, change "All" to "Inputs Marked With Collect". Then go to the @RISK Model window (List of Outputs and Inputs) and check (tick) the inputs that you want to collect.

You should be aware of an important limitation: @RISK shows only collected inputs in tornado graphs and other sensitivity outputs. If you're not sure which inputs to collect, you might run a small pilot simulation while collecting all inputs, to help you identify the ones with the greatest impact on your outputs. Then you will know which inputs to mark for collection in the full-scale simulation.

Outputs and Statistic Functions

@RISK must store the value of each output at each iteration. If you have many outputs that you don't need, remove the RiskOutput part of the formula in Excel's formula bar, or use the Model Window to remove them as outputs.

When you have a statistic function such as RiskMean or RiskPercentile pointing to a cell, @RISK must store the value of that cell at every iteration. If the cell is a @RISK output, @RISK is storing its values anyway. But if it's an input that's not being collected, or if it's neither an input nor an output, then it's an additional cell for which @RISK needs to store values. Take a look at your statistic functions and eliminate any that aren't needed.

Number of Iterations

Are you performing more iterations than necessary? Consider letting @RISK test for convergence. A pilot run will give you an idea of the number of iterations necessary, and then you can use that or a few more as your fixed number of iterations.

Number of Simulations

Do you have the number of simulations set greater than 1? There is seldom a reason to do this unless you are using RiskSimtable functions. See also Iterations versus Simulations.

Protected Sheets

Protected sheets are not an issue for @RISK 6.0 and later. But if you have one or more protected sheets in your workbook, @RISK 4.x and 5.x may not be able to perform a simulation. Try unprotecting all the sheets (including any hidden sheets that you created) and starting a simulation.