Reference counting: registering and freeing objects

PODSObject lifetime is managed by a reference counting mechanism. This mechanism is similar to the reference counting mechanism in Microsoft's COM. The rules are:

  • The PODSObject implementer should implement the addRef( ) and release( ) methods and call addRef() before returning a PODSObject.

  • When a PODSObject is returned, through either a return value or an out parameter (PODSObject**), the caller owns the object. The caller is responsible for calling the release() method when done with the object.

    Note

    The above also applies to arrays created by createStdArray( ).