MEMSIZE System Option: UNIX

Specifies the limit on the total amount of virtual memory that can be used by a SAS session.
Valid in: configuration file, SAS invocation, SASV9_OPTIONS environment variable
Category: System administration: Memory
Default: 512M
UNIX specifics: all


-MEMSIZE n | nK | nM | nG | nT | hexX | MAX

Required Arguments

n | nK | nM | nG | nT
specifies the limit in multiples of 1 (bytes); 1,024 (kilobytes); 1,048,576 (megabytes); 1,073,741,824 (gigabytes); or 1,099,511,627,776 (terabytes). You can specify decimal values for the number of kilobytes, megabytes, or gigabytes. For example, a value of .25G specifies 268,435,456 bytes.
specifies the amount of memory as a hexadecimal value. You must specify the value beginning with a number (0–9), followed by hexadecimal characters (0–9, A–F), and then followed by an X. For example, 0F00000x sets the value of the MEMSIZE option to 15,728,640 bytes. A value of 0x is equivalent to using the MAX value.
specifies to set the memory size to the largest reasonable value depending on the amounts of physical memory and paging space that are available at the time that SAS is started.


The Basics

The MEMSIZE system option limits the total amount of memory that is available to each SAS session. It places an enforced limit on the amount of virtual memory that SAS can dynamically allocate at execution. If MEMSIZE is set too low, your jobs will fail, and an error will appear in the SAS log indicating that insufficient memory was available. By contrast, the REALMEMSIZE and MAXMEMQUERY system options, the SORTSIZE= option in the SORT procedure, and the SUMSIZE= option in the SUMMARY procedure all provide for procedure tuning.
If you specify an unreasonably small numeric value for MEMSIZE (for example, 6K), then the setting automatically increases to a minimum reasonable value that will enable SAS to start. If you specify a numeric value in excess of 4,294,967,295 on a 32-bit version of SAS, then the setting automatically decreases to 4,294,967,295.
Numeric values in excess of 9,223,372,036,854,775,807 bytes will be rejected as invalid, and will prevent SAS from starting.
SAS does not automatically reserve or allocate the amount of memory that you specify in the MEMSIZE system option. SAS uses only as much memory as it needs to complete a process. For example, a DATA step might require only 20 MB of memory, so even though MEMSIZE is set to 500 MB, SAS will use only 20 MB of memory. While your SAS jobs are running, you can monitor the effects of larger memory settings by using system monitoring tools, such as VMSTAT and top. With some tools, address space might be allocated to memory, but pages might not be assigned to that memory. These tools will report a higher value than real memory actually used.

Setting the Size of MEMSIZE

Setting MEMSIZE=MAX sets MEMSIZE to 80% of physical memory. Setting MEMSIZE to MAX is the same as setting MEMSIZE to 0. Setting MEMSIZE to MAX is reasonable only if no processes that consume large amounts of memory are likely to become active after SAS has started. For example, if multiple instances of SAS are running concurrently, and all of the sessions were started with a MEMSIZE value of MAX, then one or more of these sessions can encounter out-of-memory conditions, or the operating system can run out of available paging space. MEMSIZE=MAX calculates a value that would help prevent the system from paging if all of the memory were allocated.
The optimal setting for this option depends on the other applications that are running and the system resources available at your site. The amount of memory available to SAS processes can also be limited by your system administrator.
If you set MEMSIZE to the maximum amount of memory that is reasonably attainable, some procedures scale themselves to the available memory. To determine the limit on the total amount of memory to be used by SAS, you can issue a PROC OPTIONS statement:
proc options option=MEMSIZE;
Setting MEMSIZE to 0 is used as a test that can determine a good value to set for MEMSIZE.
To determine the optimal setting of MEMSIZE, execute a SAS procedure or DATA step with the FULLSTIMER option and MEMSIZE set to 0. Note the amount of memory that is used by the process, and then set MEMSIZE to a larger amount.


Some SAS procedures use the REALMEMSIZE system option to specify how much real memory the procedure can allocate and use without inducing excessive page swapping. By contrast, the MEMSIZE system option places a limit on the total amount of virtual memory that SAS dynamically allocates at any time. This virtual memory is supported by a combination of real memory and paging space.
The operating environment begins paging when the amount of virtual memory that is required exceeds the real memory that is available. To prevent paging and the associated performance problems, the REALMEMSIZE and MEMSIZE system options should be set to a subset of real memory.

See Also