The error "java.lang.OutOfMemoryError: Java heap space" might occur when you use ODS Graphics with a large data set


The following error message might be issued when you use ODS Graphics with a large data set:

Java virtual machine exception. java.lang.OutOfMemoryError: Java heap space.
NOTE: The SAS System stopped processing this step because of errors.

To circumvent the problem, give the Java virtual machine (VM) a larger memory pool by increasing the Java heap space. This is done by increasing the values for the JRE parameters -Xms and -Xmx in the SAS®9 config file (SASV9.CFG) file to -Xms1024m and -Xmx1024m.

For example, if you are running in a Windows operating environment, do the following:

First, exit any running SAS® sessions. Using a text editor (such as Notepad, WordPad, or TextPad), edit your SAS 9 configuration file. This is the file named SASV9.CFG that resides in the following Windows directory:

!SASROOT\nls\en

!SASROOT is the default directory in which SAS is installed. If you are not sure which SAS install directory your SASV9.CFG file resides in, submit the following statements to SAS and look at the new information that is written to the log:

proc options option=config;
run;

Make a back-up copy of your SASV9.CFG file before you edit it. To edit the SASV9.CFG file, scroll down in the file until you find the line that begins with the following:

-JREOPTIONS

Scroll to the right on this line until you see the parameters -Xms and -Xmx. Change the values for both of these parameters to 1024. For example:

-Xms1024m -Xmx1024m

Do not change any other parameters on this line.  Save your modified SASV9.CFG file.

Restart SAS and resubmit your SAS program.

On UNIX and Linux, your SAS configuration file is a file with the name of sasv9.cfg located in your default SAS install or SAS home directory. Note that with most installs of SAS on UNIX and Linux, since there are no default values for -Xms and -Xmx in the JREOPTIONS, add the values above to the existing arguments on the default JREOPTIONS in the sasv9.cfg file.