Storage management

A z/OS® XL C/C++ program can acquire storage from and release storage to CICS TS either implicitly or explicitly.

Storage is acquired and released implicitly by the runtime environment. This storage is used for automatic, external, and static variables. External variables are valid until program completion.

Storage is acquired and released explicitly by the user with the C library functions malloc(), calloc(), realloc(), or free(), with z/OS Language Environment® Callable Services (refer to z/OS Language Environment Programming Guide), with the C++ new and delete operators, or with the EXEC CICS commands EXEC CICS GETMAIN, or EXEC CICS FREEMAIN.

All other combinations of methods of requesting and deallocating storage are unsupported and lead to unpredictable behavior.

Partial deallocations are not supported. All storage allocated at a given time must be deallocated at the same time.

Under the z/OS Language Environment library, z/OS XL C/C++ uses the z/OS Language Environment Callable Services to allocate and free storage. Refer to z/OS Language Environment Programming Guide for specific information on memory and storage manipulation in CICS.

The z/OS XL C/C++ library functions acquire all storage from the Extended Dynamic Storage Area (EDSA) unless you specify otherwise using the ANYHEAP, BELOWHEAP, HEAP, STACK, or LIBSTACK runtime options.

Storage that is acquired with the EXEC CICS GETMAIN command exists for the duration of the CICS task.

If your application is multi-threaded or often uses malloc(), realloc(), calloc(), and free(), you should consider using the HEAPPOOLS runtime option. Although storage requirements may increase, you can expect better performance.