CRE Programmer's Guide

CRE Services
Common Run-Time Environment (CRE) Programmer’s Guide528146-004
2-46
Using the Programmatic Heap-Management
Attributes
Setting Heap-Management Attributes
You can set five heap attributes: minimum block, erase on free, erase on get, segment
threshold, and segments max.
The C syntax of the routine for setting a heap-management attribute is:
int RTL_heap_setattribute_ ( int Attribute, size_t Value ) ;
Attribute is an ordinal that specifies the heap attribute. Table 2-5 on page 2-46
defines the ordinals for
Attribute.
Value supplies the value to be assigned to the specified attribute.
The routine returns 0 if the call succeeds, or 1 if
Attribute is not recognized, or 2 if
Value (interpreted as a signed integer) is negative.
Table 2-5. Heap-Management Attributes for the High-Performance Heap Manager
(page 1 of 2)
Attribute Name Definition and Default Value Attribute Value
RTL^Heap^min^block Minimum size in bytes of a block
allocated from the heap space. Can
be used to prevent accumulation of
numerous unusable chunks of heap
space.
0D
RTL^Heap^erase^on^free Zero = Off
Nonzero = On
(The heap manager overwrites the
contents of released space with
repetitions of the hexadecimal value
FFFC3C3C.) Can be used to identify
programs that erroneously use data
from freed blocks.
1D
RTL^Heap^erase^on^get Zero = Off
Nonzero = On
(The heap manager initializes the
contents of allocated space with
repetitions of the hexadecimal value
FFFC2B2B.) Can be used to identify
where a program fails to initialize
dynamically allocated space.
2D
RTL^Heap^segment^
threshold
The size in bytes beyond which the
heap manager can optionally allocate
flat extended segments. Below this
size, the heap manager will not
allocate flat or external segments.
Default value: 16384 * 2048
(33,554,432)
3D