ObjAddRef / ObjRelease

Increments or decrements an object's reference count.

NewRefCount := ObjAddRef(Ptr)
NewRefCount := ObjRelease(Ptr)

Parameters

Ptr

Type: Integer

An unmanaged object pointer or COM interface pointer.

Return Value

Type: Integer

These functions return the new reference count. This value should be used only for debugging purposes.

Reference Counting

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.