Increments or decrements an object's reference count.
ObjAddRef(Ptr) ObjRelease(Ptr)
An unmanaged object pointer or COM interface pointer.
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.
Retrieves the pointer of an object and increments the reference count. For details, see Pointers to Objects.
obj := Object() ; The following two lines are equivalent: ptr1 := Object(obj) ptr2 := ObjectToPointer(obj) ObjectToPointer(obj) { if !IsObject(obj) return "" ptr := &obj ObjAddRef(ptr) return ptr } ; Each pointer retrieved via Object() or ObjectToPointer() must be manually released ; to allow the object to be eventually freed and any memory used by it reclaimed. ObjRelease(ptr2) ObjRelease(ptr1)
For another example, see ComObjConnect().