BookmarkSubscribeRSS Feed
ninemileshigh
Obsidian | Level 7

I am using SAS 9.4 M3 in Windows 10. It's a new installation after a Windows rebuild. 

 

I am trying to draw a graph from a large dataset (4.5 gb) using Sgplot. The code  runs really slowly and eventually I get the following error code:

ERROR: Java virtual machine exception. java.lang.OutOfMemoryError: Java heap space.

 

I have tried to change the java heap space allocated to SAS using a couple of different methods:

 1. by altering jre options in the the config file. I have changed the config file so that 

 

-Xms1024m
-Xmx1024m

 

2. I have also tried to alter the default java heap space in Windows

 

https://stackoverflow.com/questions/17369522/set-default-heap-size-in-windows

 

3. I also tried opening SAS from a command prompt with the following jre options specified

 

"c:\program files\SASHome\SASFoundation\9.4\sas.exe" -ls 80 -ps 60
-config "C:\Program Files\SASHome\SASFoundation\9.4\nls\en\sasv9.cfg"
-jreoptions '(-Xmx1024m -Xms2048m)'

 

None of these has altered the heap space, which I check by running the following:

 

proc options option=jreoptions; run; 

 

The log returns 

 

JREOPTIONS=(/* other Java suboptions */ -Xmx128m -Xms128m)

 

What am I doing wrong?

 

In addition to failing to draw a graph of the whole dataset, SAS runs extremely slowly when asked to draw many graphs on subests of the data. I haven't had these problems on previous installations of SAS. The time taken to create 2128 graphs is:

 

NOTE: Writing HTML Body file: sashtml.htm
NOTE: PROCEDURE SGPLOT used (Total process time):
real time 4:35:13.73
cpu time 1:55.37

 

Which equates to approximately 3.25 secnods of CPU time per graph- which seems really long. 

5 REPLIES 5
JosvanderVelden
SAS Super FREQ
Do you want to set the jreoptions just for a single session or permanently?
If for a single session you can start sas via the command prompt with something like "sas -jreoptions '(-Xmx256m -Xms256m)'" Note: you can use higher values ex 512m or even 1024m but should only do that if needed and if you have lots of RAM. The suggested value is 1/4 of the memsize option set for the sas session. If you want to create a customized configuration file please read: https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/hostwin/p0bmj7wjme32ayn1h4wim7trkhp6.htm#n19n...
ninemileshigh
Obsidian | Level 7

thank you for your reply. I owuld probably want to alter this permanently since I often use very large datasets.

 

I have 8 gb of RAM, so would it make sense to increase the allocation as much as I can to speed up sgplot?

 

The problem is, none of the methods of increasing heap space are working: I have tried a command prompt with increased jre options, AND I have also altered the config file, and yet SAS still only has 128 mb allocated. 

JosvanderVelden
SAS Super FREQ
I was able to change the sas9.cfg to change jreoptions memsize and sortsize.
I verified the changes and the changes were correctly applied. In your case I would advice against changing the defaults since you have only 8gb RAM. You will always have make sure the OS has enough RAM to run. So if you would like to change then memsize could be set to 4gb and in that case jreoptions could be set to -Xmx256m -Xms1024m. I doubt that would change the outcome regarding the "Java virtual machine exception". If you want to try please let me know.
ballardw
Super User

One might also consider the actual SGPLOT code involved. How much of that 4.5 Gb dataset is actually used by Sgplot? What type of plot/plots are involved? Perhaps a different plot approach would reduce memory need.

Reeza
Super User
Trying to graph 4.5GB of data seems like it would tax a system for sure.

Can you pre-summarize or simplify the data before using SGPLOT?

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1809 views
  • 2 likes
  • 4 in conversation