Show TOC

Background documentationHandling of Memory Bottlenecks Locate this document in the navigation structure

 

The shared memory of an application server is a limited resource. The ABAP runtime environment uses it to store programs, program data, buffers, and so on. Explicit ABAP programming can access either data clusters in cross-transaction application buffers or shared objects in the shared objects memory.

How much of the shared memory can be used as a maximum by the different users is defined statically by means of profile parameters. Transaction ST02 (SAP Memory Management) shows the current utilization of the shared memory and the related profile parameters.

If the amount of memory allocated to the shared objects memory is exceeded when shared objects are used, a treatable exception of class CX_SHM_OUT_OF_MEMORY is triggered. This exception can occur in different situations:

  • When shared objects are created or changed in the shared memory

  • When locks are removed with DETACH_COMMIT

  • When locks are created with ATTACH_FOR_WRITE, ATTACH_FOR_UPDATE, and even with ATTACH_FOR_READ (if there is no longer sufficient space for the administration information)

For this reason, we recommend that you handle the exception CX_SHM_OUT_OF_MEMORY for all accesses to the shared objects memory. The easiest way to do this is when all accesses to shared objects, which ideally occur only within one wrapper class, also take place only in one single TRY control structure in which this exception is handled. If a change lock on the area still exists when the exception is handled (which can be determined with the GET_LOCK_KIND method of the area handle), you should remove it with DETACH_ROLLBACK.

To handle the exception CX_SHM_OUT_OF_MEMORY, you can implement a suitable fallback strategy, for example, to create the required objects in the internal session and copy the previous content from the shared memory to these objects.