C/C++ Programmer's Guide (G06.27+, H06.03+)

Table Of Contents
Compiler Pragmas
HP C/C++ Programmer’s Guide for NonStop Systems429301-010
13-40
HEAP
The pragma default settings are:
Usage Guidelines
If the RUNNABLE pragma is not specified, the HEAP pragma does not affect the
compilation.
One page equals 2048 bytes (2 kilobytes).
If you do not use the HEAP pragma when compiling a TNS program with the
RUNNABLE pragma, the compiler automatically provides a heap of one page.
For native C/C++, the HEAP pragma must be entered on the compiler RUN
command line; for TNS C and c89 in the OSS environment, the pragma can be
entered either on the compiler RUN command line or in the source text.
Native C and C++ programs use a different heap architecture than TNS programs.
Because of this, native C and C++ programs normally do not need to specify
maximum heap size; the default value for the heap_max attribute of a program file
is zero, indicating that the size of the heap is limited only by available resources.
For native C and C++ programs, you should not specify the HEAP pragma unless
there is an unusual reason to limit the heap size to less than the capacity of the
program address space.
The HEAP pragma specifies an upper bound on heap size by setting the
heap_max attribute in a new loadfile; for example, specifying HEAP n BYTES is
equivalent to specifying -set heap_max n to the eld linker for the loadfile.
You do not need to recompile to change the setting. The HEAP pragma setting and
-set heap_max setting can be replaced later by using the linker command
-change heap_max n filename, where filename designates the program file.
See the appropriate linker manual for information on setting the heap_max flag
with the appropriate number of bytes.
If you do not use the HEAP pragma when compiling a native program with the
RUNNABLE pragma, the compiler leaves the maximum heap size unspecified. This
SYSTYPE GUARDIAN SYSTYPE OSS
TNS C compiler HEAP 1 PAGES HEAP 1 PAGES
G-series TNS c89 utility HEAP 1 PAGES HEAP 1 PAGES
TNS/R native C and C++ compilers Not set
(see Usage Guidelines
)
Not set
(see Usage Guidelines)
Native c89 utility Not set
(see Usage Guidelines
)
Not set
(see Usage Guidelines)
TNS/E native C and C++ compilers Not set
(see Usage Guidelines
)
Not set
(see Usage Guidelines)