SAP SHM OBJECTS OUT OF MEMORY



Get Example source ABAP code based on a different SAP table
  



ABAP_SHM - Memory Bottlenecks
The shared memory of an ABAP_ASINSTANCE is a limited resource. The ABAP runtime framework uses it to store programs, program data, buffers and so on. With explicit ABAP programming, either data clusters in cross-transaction application buffers or shared objects in the shared objects memory can be accessed.
The maximum amount of shared memory that can be occupied by the different users is defined statically using profile parameters. Transaction ST02 shows the current utilization of the shared memory and the associated profile parameters.
If the memory allocated for the shared objects memory using the profile parameter abap/shared_objects_size_MB is exceeded when shared objects are used, a catchable exception of class CX_SHM_OUT_OF_MEMORY is raised. This exception can be raised in the following situations:
When shared objects are created or changed in the shared memory
When locks are removed using DETACH_COMMIT
When locks are created using ATTACH_FOR_WRITE or ATTACH_FOR_UPDATE, and even using ATTACH_FOR_READ if there is no longer sufficient space for the administration information.
For this reason, it is recommended that the exception CX_SHM_OUT_OF_MEMORY is handled each time the shared objects memory is accessed. This is easiest when all accesses to shared objects, which in ideal situations only occur within a single wrapper class, also take place in a single TRY control structure in which the exception is handled. If there is still a change lock on the area when the exception is handled, which can be determined using the method GET_LOCK_KIND of the area handle), it should be removed using DETACH_ROLLBACK.



Latest notes:

A suitable fallback strategy should be implemented to handle the exception CX_SHM_OUT_OF_MEMORY that for example creates the required objects in the ABAP_ISESS and copies the previous content from the shared memory to these objects.
ABAP_HINT_END