Automatic Resource Management

Automatic resource management is designed to increase the baseline usability of the Symbian platform for Symbian Developers.

Need for Automatic resource management

The use of the Symbian Cleanup Stack is more difficult, error-prone and requires writing extra code for explicit cleanup using the CleanupStack. In contrast, the Symbian C++ class templates for automatic resource management are relatively easier to use. They provide automatic exception-safe cleanup upon normal or exceptional exit from a scope, in which case they do not require writing any code for invoking the cleanup of resources. The resources are automatically cleaned up by the destructors of the template classes in that case.

Characteristics of Automatic resource management

The following are the characteristics of automatic resource management:

  • Improved usability versus the cleanup stack and the manual authoring of destructors.

  • Covering data member management as well as local variable management.

  • A comprehensive replacement for the existing cleanup stack API.

  • Ability to handle C-classes, R-classes, and custom cleanups.

Template classes

The following variants of the class templates for automatic resource management have been provided:

  • LCleanedup class templates

    The LCleanedup class templates provided are:

    Templates Description

    LCleanedupPtr

    Provides automatic management of pointers

    LCleanedupHandle

    Provides automatic management of resource handles

    LCleanedupRef

    Provides automatic management of object references

    LCleanedupArray

    Provides automatic management of C++ style arrays

    LCleanedupGuard

    Provides automatic generic cleanup

  • LManaged class templates

    The LManaged class templates provided are:

    Templates Description

    LManagedPtr

    Provides automatic management of pointers

    LManagedHandle

    Provides automatic management of resource handles

    LManagedRef

    Provides automatic management of object references

    LManagedArray

    Provides automatic management of C++ style arrays

    LManagedGuard

    Provides automatic generic cleanup