Notice: These functions affect native COM interface pointers. They do not control the lifetime of ordinary managed objects; retain or release a normal object simply by assigning or clearing references to it.
Increments or decrements an object's reference count.
NewRefCount := ObjAddRef(Ptr) NewRefCount := ObjRelease(Ptr)
Type: Integer
An unmanaged object pointer or COM interface pointer.
Type: Integer
These functions return the new reference count. This value should be used only for debugging purposes.
Although the following articles discuss reference counting as it applies to COM, they cover some important concepts and rules which generally also apply to AutoHotkey objects: IUnknown::AddRef, IUnknown::Release, Reference Counting Rules.