Reference Counting Rules (104138)
The information in this article applies to:
- Microsoft OLE Libraries for Windows and Win32s 2.0
- Microsoft OLE Libraries, when used with:
- the operating system: Microsoft Windows NT 3.5
- the operating system: Microsoft Windows NT 3.51
- the operating system: Microsoft Windows NT 4.0
- the operating system: Microsoft Windows 95
- the operating system: Microsoft Windows 2000
This article was previously published under Q104138 SUMMARY
In the component object model, an interface's lifetime is controlled
through reference counting. The reference count for an interface is
manipulated through the AddRef() and Release() member functions
inherited from IUnknown. The AddRef() member increments an interface's
reference count, and the Release() method decrements it. Once an
interface's reference count goes to zero, there are no longer any
valid pointers to that interface. If the reference count on all of an
object's interfaces is zero, then the object can be freed because
there are no longer any pointers to the object.
Modification Type: | Major | Last Reviewed: | 12/3/2003 |
---|
Keywords: | kbprogramming KB104138 |
---|
|