-qmaxmem

Category

Optimization and tuning

Purpose

Limits the amount of memory that the compiler allocates while performing specific, memory-intensive optimizations to the specified number of kilobytes.

Syntax

Read syntax diagramSkip visual syntax diagram
>>- -q--maxmem--=--Kbytes--------------------------------------><

@PROCESS:

@PROCESS MAXMEM(Kbytes)

Defaults

Parameters

Kbytes
The number of kilobytes worth of memory to be used by optimizations. The limit is the amount of memory for specific optimizations, and not for the compiler as a whole. Tables required during the entire compilation process are not affected by or included in this limit.

A value of -1 permits each optimization to take as much memory as it needs without checking for limits.

Usage

If the specified amount of memory is insufficient for the compiler to compute a particular optimization, the compiler issues a message and reduces the degree of optimization.

This option has no effect except in combination with the -O option.

When compiling with -O2, you only need to increase the limit if a compile-time message instructs you to do so. When compiling with -O3, you might need to establish a limit if compilation stops because the machine runs out of storage; start with a value of 8192 or higher, and decrease it if the compilation continues to require too much storage.
Note:
  1. Reduced optimization does not necessarily mean that the resulting program will be slower. It only means that the compiler cannot finish looking for opportunities to improve performance.
  2. Increasing the limit does not necessarily mean that the resulting program will be faster. It only means that the compiler is better able to find opportunities to improve performance if they exist.
  3. Setting a large limit has no negative effect when compiling source files for which the compiler does not need to use so much memory during optimization.
  4. As an alternative to raising the memory limit, you can sometimes move the most complicated calculations into procedures that are then small enough to be fully analyzed.
  5. Not all memory-intensive compilation stages can be limited.
  6. Only the optimizations done for -O2 and -O3 can be limited; -O4 and -O5 optimizations cannot be limited.
  7. The -O4 and -O5 optimizations may also use a file in the /tmp directory. This is not limited by the -qmaxmem setting.
  8. Some optimizations back off automatically before they exceed the maximum available address space, but not before they exceed the paging space available at that time, which depends on machine workload.

Restrictions

Depending on the source file being compiled, the size of subprograms in the source code, the machine configuration, and the workload on the system, setting the limit too high might fill up the paging space. In particular, a value of -1 can fill up the storage of even a well-equipped machine.

Related information