Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Declarations →  Declaration Statements →  Classes and Interfaces →  ABAP Objects - Overview →  Objects 

Weak References

An object in the system class CL_ABAP_WEAK_REFERENCE represents a weak reference to an object in a class. Unlike regular object references, a weak reference is ignored during execution of the garbage collector. This means that a weak reference does not prevent the referenced object from being deleted when the garbage collector is executed.

A weak reference to an existing object is created by passing an object reference to the instance constructor of CL_ABAP_WEAK_REFERENCE. You can then use the functional method GET to retrieve the reference afterwards. If the object was deleted in the meantime, the return value is initial.

Other versions: 7.31 | 7.40 | 7.54


Note

A different type of reference retains objects until the available memory becomes limited. The class CL_ABAP_SOFT_REFERENCE is available for these soft references, but this class is currently still implemented in the same way as class CL_ABAP_WEAK_REFERENCE.