Optimize IT resource capacity and performance with SAS

Problem with memsize

Super Contributor
Posts: 258

Problem with memsize

i facing error:

ERROR: Unable to allocate sufficient memory. At least 12600K bytes were requested. You must either increase the amount of memory

       available, or approach the problem differently.

ERROR: The SAS System stopped processing this step because of insufficient memory.

I tried to use option memsize=0 ; at the starting of my script. but it doesnt work.

kindly suggest me on the same.

thanks in advance.

Grand Advisor
Posts: 9,748

Re: Problem with memsize

What did you set memsize to? Does your system actually have that much memory (plus enough for OS and other programs running)?

Super Contributor
Posts: 258

Re: Problem with memsize

I have tried  option memsize=0;  and no other program is running. And how can i know about my system memory as u suggested. I am not running batch script, i m running script in window mode

New Contributor
Posts: 2

Re: Problem with memsize


You can run a

proc options group=memory;run; and check current memsize setting. 

Memsize cannot be changed dynamically, if I remember correctly. If can be changes in the sas configuration options.

Also, please run again with

options fullstimer;

before the step that fails and this will report the amount of memory it uses.

Let us no.


Super Contributor
Posts: 258

Re: Problem with memsize

i tried to set -memsize=2G in config file.

and run proc option

got result:


                   Maximum amount of memory allocated to support MEMLIB and MEMCACHE options.

LOADMEMSIZE=0     Suggested memory limit for loaded SAS executables


                   Specifies the limit on the total amount of memory to be used by the SAS System

REALMEMSIZE=0     Limit on the total amount of real memory to be used by the SAS System

NOTE: PROCEDURE OPTIONS used (Total process time):

      real time           0.04 seconds

      cpu time            0.00 seconds

then run my script. still same error:

ERROR: Unable to allocate sufficient memory. At least 12600K bytes were requested. You must either increase the amount of memory        available, or approach the problem…

Respected Advisor
Posts: 2,919

Re: Problem with memsize

In my experience 2G is a sufficient MEMSIZE setting for most SAS programs. With SAS 9.4 2G is in fact the SAS default setting. Also how much physical memory does your SAS computer have?

I suggest you also post the code giving the error so we can offer advice on that.

Senior User
Posts: 1

Re: Problem with memsize

I would increase the "MEMSIZE=2G" statement in your config file to some much larger number plus add the "OPTIONS FULLSTIMER;" statement.  After it runs successfully, check the SAS Log to see how much memory was actually used.  Then you can alter the MEMSIZE value to a number slightly higher than what is needed.  One thing to remember, is that SAS will allocate whatever memory is needed up to the MEMSIZE value.  If you have a MEMSIZE=50G in your config file and only need 10G, then SAS will only allocate 10G, not the 50G that is in the config.  You also should know how much memory is even available on your server....128G, 256G, etc.  What step are you even running?  PROC SORT?  DATA STEP HASH programming step?  PROC SQL with GROUP BY?  Are you JOINing multiple datasets?  How large are the input file(s)?  These are things you need to know to help determine how much memory you might need.

Super Contributor
Posts: 358

Re: Problem with memsize

You also haven't mentioned what system you are running SAS on.  Some systems, like z/OS have much greater restrictions on memory

use and require specific steps to get more for your program.  From what I recall, the memsize=0 hole has been patched on most systems

so it won't just give you everything available.

Esteemed Advisor
Posts: 5,995

Re: Problem with memsize

12600K evaluates to appr. 12.5 MB, WAY below your 2GB. I suspect you run into a limit imposed by the operating system.

Post OS data, code and log.

Maxims of Maximally Efficient SAS Programmers
Super Contributor
Posts: 258

Re: Problem with memsize

Hi all,

Thanks for all valuable input. I am working on it.

I am not able to post the data or code bcaz its very lengthy.

my script to run many reports excel[near about 500+] and after that 500+ charts for related area's in PDF.

script run fine but at last it show error reaching 440's area during creating charts.

i have changed memsize in config file as 0 , max, and 2G, but nothing work.

I am still working on that .

once again thanks for your valuable input.

Valued Guide
Posts: 3,206

Re: Problem with memsize

You should know your machine environment well. Do not overspecify memory setting as you can run into thrashing.

http://en.wikipedia.org/wiki/Thrashing_(computer_science). At a server environment you have to deal with many users you could do something with serviceclasses (wlm). This is implemented with the latest Unix versions with Cgroups cgroups - Wikipedia, the free encyclopedia

This is a dedicated area to know what you are doing. Contact the related admins for that.

---->-- ja karman --<-----
Occasional Contributor
Posts: 9

Re: Problem with memsize

If you are running on UNIX or LINUX, you may be able to run the ulimit command to find out how much memory is available to SAS; e.g. the following code would show in the SAS log the amount of memory available from the operating system (soft limit) for a process (but doesn't reflect how much SAS requested) and then show the amount of memory that could be allocated (hard limit) for a process.

filename foo pipe "ulimit -Sa" ;
data _null_ ;
infile foo ;
input ;
put _infile_ ;
run ;

filename foo pipe "ulimit -Ha" ;
data _null_ ;
infile foo ;
input ;
put _infile_ ;
run ;

Post a Question
Discussion Stats
  • 11 replies
  • 9 in conversation