ABAP Keyword Documentation → ABAP − Reference → Creating Objects and Values → Shared Objects → Shared Objects - Objects
Shared Objects - Memory Bottlenecks
The shared memory of an AS Instance is a limited resource. The ABAP runtime environment uses it to store programs, program data, buffers and so on. Explicit ABAP programming can be used to access either data clusters in cross-transaction application buffers or shared objects in the shared objects memory.
The maximum amount of shared memory that can be occupied by the different consumers is defined statically using profile parameters. Transaction ST02 shows the current utilization of the shared memory and the related profile parameters.
If the amount of memory allocated to the shared objects memory (by the profile parameter abap/shared_objects_size_MB) is exceeded when shared objects are used, a handleable 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 (or even using ATTACH_FOR_READ if there is no longer sufficient space for the administration information)
For this reason, it is best to handle the exception CX_SHM_OUT_OF_MEMORY each time the shared objects memory is accessed. This is easiest when all accesses to shared objects (in ideal situations, these only occur within a single wrapper class) also take place in a single TRY control structure and the exception is handled in this structure. If an exclusive lock on the area still exists when the exception is handled (this can be identified using the method GET_LOCK_KIND of the area handle), it should be removed using DETACH_ROLLBACK.
Other versions:
7.31 | 7.40 | 7.54
Note
A suitable fallback strategy should be implemented to handle the exception CX_SHM_OUT_OF_MEMORY, for example a strategy to create the required objects in the internal session and copy the previous content from the shared memory to these objects.