Guardian Programmer's Guide

Table Of Contents
Managing Memory
Guardian Programmer’s Guide 421922-014
17 - 13
Managing the Native User Data Areas
Changing the Maximum Size of the Heap
The heap is managed by the Common Run-Time Environment (CRE). It is created at
a system-defined initial size and is increased automatically as needed during process
execution. For pre-G05 systems, the maximum allowable size of the heap defaults to
the difference between 128 megabytes (the maximum combined size of the heap and
globals area) and the size of the globals area (fixed at process creation time). In case
of G05 and later systems, the default maximum allowable heap size of native process
(the total of user heap, global variables, and flat segments) is 1120 MB and 1532 in all
H-series and later RVUs.
You can change the maximum size of the heap through either the
PROCESS_LAUNCH_ procedure or the native static loader (nld in the TNS/R
environment and eld in the TNS/E environment). However, there is little reason to do
so, since you can currently change it only to a smaller value. You might want to do this
for debugging purposes; for example, to force a process to terminate with a heap
overflow condition.
To set the maximum size for the heap through the PROCESS_LAUNCH_ procedure,
specify the heap^max parameter in the procedure call or specify the heap_max option
when invoking nld or eld. This sets the value of the HEAP^MAX process attribute,
which defines the upper limit of the heap.
Changing the Maximum Size of the Main Stack
The size of the main stack increases automatically as needed during process
execution up to a default limit of 1 megabyte in the TNS/R environment or 2 megabytes
in the TNS/E environment. You can increase this limit up to a maximum of
32 megabytes either by calling the PROCESS_LAUNCH_ procedure or by using nld (in
the TNS/R environment) or eld (in the TNS/E environment).
RISC and Itanium stack growth is as follows: (Note that TNS stacks grow upward.)
RISC stacks grow downward (from higher to lower addresses)
The Itanium RSE backing store grows upward
Itanium memory stacks grow downward
On both TNS/R and TNS/E CPUs, the main stacks (main RISC stack on TNS/R, main
memory stack on TNS/E) and the heap grow automatically as needed, to a maximum
size. On the TNS/R platform, the default maximum stack size is one MB, and on the
TNS/E platform, the default maximum stack size is two MB. You can increase the
maximum stack size via an eld or PROCESS_LAUNCH_ parameter up to a limit of
32MB.
To set the maximum size for the main stack through the PROCESS_LAUNCH_
procedure, specify the mainstack^max parameter in the procedure call. This sets the
value of the MAINSTACK^MAX attribute, which defines the maximum size, in bytes, of
the main stack. The following example calls PROCESS_LAUNCH_ to create an