CRE Programmer's Guide
CRE Services
Common Run-Time Environment (CRE) Programmer’s Guide—528146-004
2-37
Memory Organization
Memory Organization
This subsection describes the overall layout of memory for programs that use the 
services of the CRE, and the data spaces that your program can use to share data.
TNS CRE Memory
In the TNS CRE, the data spaces that your program can use to share data are:
•
The extended stack
•
The user heap
•
Global data
The CRE allocates memory using the same layout in the OSS and Guardian 
environments. For a given total amount of memory allocated to a process, however, 
the amount of memory available in the OSS environment might be somewhat different 
than the amount available to the same process running in the Guardian environment.
Overall Memory Organization
The TNS CRE, the language-specific run-time libraries, and your code share the same 
address space for their data, although each has its own block of memory within that 
space. The TNS CRE and run-time libraries allocate their data in the upper 32K words 
of the user data segment and in extended memory. If your program specifies a small-
memory model, the TNS CRE allocates the heap in the lower 32K words of your user 
data segment, just below the run-time stack. If your program specifies a large-memory 
model or a wide-memory model, the TNS CRE allocates the heap as the last data 
block in the extended segment. 
If you use the TNS CRE, Binder ensures that the data structures for the language-
specific run-time libraries and for the TNS CRE do not overlay each other.
Your program maintains its data in the lower 32K words of the user data segment and 
in extended memory. 
Figure 2-14
 on page 2-38 shows the overall memory organization for a program that 
runs in a small-memory model and uses the TNS CRE. Figure 2-15
 on page 2-39 
shows the overall memory organization for a program that runs in a large-memory 
model or a wide memory model, and that uses the TNS CRE. Shaded boxes in the 
figures contain TNS CRE or language-specific run-time library data. Note that:
•
The TNS CRE and run-time libraries store their data in the upper 32K words of the 
user data segment, beginning at the 32K-word boundary.
•
The TNS CRE allocates the user heap in the lower 32K words of the user data 
segment just below the data stack in a small-memory model (Figure 2-14
 on 
page 2-38). The TNS CRE allocates the user heap in the extended memory 
segment in a large-memory model and a wide-memory model (Figure 2-15
 on 
page 2-39).










