Note: These functions manage native COM references, including those of a script object's COM wrapper, not AutoHotkey's script-object reference count. They are available only on Windows; on Linux and macOS, they throw an error.
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.