Sunday, July 22, 2007

COM: Reference Counting, IUnknown, AddRef, Release

Reference Counting: COM
• COM does not remove an unreference object automatically
• Programmer is supposed to remove the unused object
• Programmer decides to remove on the basis of reference count
• COM uses IUnknown methods AddRef and Release to manage reference count
• AddRef is called whenever a client receives an interface pointer
• Release: when client has finished using the interface pointer, it must call Release

No comments:

Post a Comment