Platforms to show: All Mac Windows Linux Cross-Platform

GetObjectReferenceCountMBS(o as object) as integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
global method XojoRuntime MBS Util Plugin 20.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Queries object reference count.
Example
Dim o As Object = window1

System.DebugLog "Reference count: "+Str(GetObjectReferenceCountMBS(o))

dim k as Object = o

System.DebugLog "Reference count: "+Str(GetObjectReferenceCountMBS(o))

dim v as Variant = o

System.DebugLog "Reference count: "+Str(GetObjectReferenceCountMBS(o))

v = Nil
k = nil

System.DebugLog "Reference count: "+Str(GetObjectReferenceCountMBS(o))

This function uses internal knowledge of the object layout in memory.
So this will break in case a future Xojo version changes the layout.
Please use only carefully for debugging.

The items on this page are in the following plugins: MBS Util Plugin.


The biggest plugin in space...