IUnknown::Release

Send Feedback

The Release method decrements the reference count for the calling interface on an object. If the reference count on the object falls to 0, the object is freed from memory.

Syntax

ULONG Release(void);

Parameters

None.

Return Values

Returns the resulting value of the reference count, which is used for diagnostic or testing purposes only.

Remarks

If IUnknown::AddRef has been called on this object's interface n times and this is the n+1 call to Release, the implementation of AddRef must cause the interface pointer to free itself. When the released pointer is the only existing reference to an object (whether the object supports single or multiple interfaces), the implementation must free the object.

Note   Aggregation of objects restricts the ability to recover interface pointers.

Call this function when you no longer need to use an interface pointer. If you are writing a function that takes an in/out parameter, call Release on the pointer you are passing in before copying the out-value on top of it.

Requirements

Pocket PC: Pocket PC 2002 and later
Smartphone: Smartphone 2002 and later
OS Versions: Windows CE 3.0 and later
Header: unknwn.h

See Also

IUnknown | IUnknown::AddRef | Messaging

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.