CRE Programmer's Guide
CRE Services
Common Run-Time Environment (CRE) Programmer’s Guide—528146-004
2-44
Undetected Logic Errors Can Exist in Code that
Uses the Original Heap Manager
•
The original heap manager, contained in product T8431G09 (Native CRE/RTL). 
This heap manager is not available on H-series systems.
Both native heap managers offer two external features:
•
The overwrite released-space feature, which you can use at run time to detect 
errors in handling heap memory in your applications
•
Programmatic setting of heap-management attributes, which you can use to 
monitor particular attributes of heap management
Undetected Logic Errors Can Exist in Code that Uses the 
Original Heap Manager
When a program releases dynamically allocated (heap) memory, the content of the 
freed memory block is no longer valid and should not be accessed as if it were still 
allocated.
Space can be released to the heap manager in several ways, including explicit calls to 
the 
free() function or the C++ delete function. In addition, destruction of a C++ 
object can involve implicit release operations, and programs that use packages such 
as 
tools.h++ typically create instances of implicit release operations when they 
delete members of collections or elements of lists managed by these packages.
With the new high-performance heap manager, data in freed blocks is more likely to be 
overwritten than with the original heap manager. For this reason, in some cases client 
programs using the original heap manager could refer to data values in freed blocks 
with impunity. However, if a client program using the new heap manager refers to data 
values in freed memory blocks, unexpected results may occur, and the program may 
fail altogether.
Therefore, HP recommends that you verify that your applications do not attempt to 
access data in space that has been released. You can verify your applications by using 
the overwrite released space feature.
Using the Overwrite Feature to Detect Logic Errors
If your NonStop server is running the NSK CRE/RTL (T1269), all your processes use 
the new high-performance heap manager and they must be correct in their heap 
usage.
You can identify programs that perform erroneous memory handling by using the 
overwrite released-space feature. You can enable this feature by setting DEFINEs or 
PARAMs, or by programmatically setting the RTL^Heap^erase^on^free attribute, 
described in Table 2-5
. 
When the overwrite feature is enabled, if a program retrieves data from space it has 
released (an invalid action), the program will no longer obtain the values that resided in 
that space before the space was released. The value obtained may cause the program 
to behave differently than intended, thus alerting you that invalid logic exists in the 
program.










