Purpose
Limits the amount of memory that the compiler
allocates while performing specific, memory-intensive optimizations
to the specified number of kilobytes.
Syntax
>>- -q--maxmem--=--Kbytes--------------------------------------><
@PROCESS:
@PROCESS MAXMEM(Kbytes)
Defaults
- maxmem=8192 when -O2 is in effect.
- maxmem=-1 when -O3 or higher
optimization is in effect.
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: - 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.
- 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.
- 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.
- 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.
- Not all memory-intensive compilation stages can be limited.
- Only the optimizations done for -O2 and -O3 can
be limited; -O4 and -O5 optimizations
cannot be limited.
- The -O4 and -O5 optimizations
may also use a file in the /tmp directory. This is not limited by
the -qmaxmem setting.
- 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.