C++ objects are usually stored on the stack or heap- see Creating an object. Objects on the stack are automatically destroyed when they go out of scope, but objects on the heap are not.
Many of the objects that the CICS® Foundation Classes create internally are created on the heap rather than the stack. This can cause a problem in some CICS server environments.
On CICS Transaction Server for OS/390®, CICS and Language Environment® manage all task storage so that it is released at task termination (normal or abnormal).
In a CICS for OS/2 or CICS for AIX® environment, as in the earlier Technology Releases for those platforms, storage allocated on the heap is not automatically released at task termination. This can lead to "memory leaks" if the application programmer forgets to explicitly delete an object on the heap, or, more seriously, if the task abends.
This problem has been overcome in the CICS Foundation Classes by providing operators new and delete in the base Foundation Class, IccBase. These can be configured to map dynamic storage allocation requests to CICS task storage, so that all storage is automatically released at task termination. The disadvantage of this approach is a performance hit as the Foundation Classes typically issue a large number of small storage allocation requests rather than a single, larger allocation request.
This facility is affected by the Icc::initializeEnvironment call that must be issued before using the Foundation Classes. (This function is called from the default main function--see main function.)
The first parameter passed to the initializeEnvironment function is an enumeration that takes one of these three values:
The default main function supplied with the Foundation Classes calls initializeEnvironment with an enum of 'cmmDefault'. You can change this in your program without changing the supplied "header file" ICCMAIN as follows:
#define ICC_CLASS_MEMORY_MGMT Icc::cmmNonCICS
#include "iccmain.hpp"
Alternatively, set the option DEV(ICC_CLASS_MEMORY_MGMT) when compiling.
[[ Contents Previous Page | Next Page Index ]]