Module

Runtime


Description

Returns information about the current state of the Runtime environment. This information can be useful for debugging purposes.

Properties

Name

Type

Read-Only

Shared

MemoryUsed

UInt64

ObjectCount

Integer

Methods

Name

Parameters

Returns

Shared

IterateObjects

ObjectIterator

ObjectClass

index As Integer

String

ObjectID

index As Integer

Integer

ObjectRefs

index As Integer

Integer

Property descriptions


Runtime.MemoryUsed

MemoryUsed As UInt64

Returns the total amount of memory used (in bytes) by the allocated objects.

This property is read-only.

More specifically, this returns the number of malloc'd bytes. Since the OS does not immediately give back memory after it is released there is no guarantee that this number will match OS values that you see in Activity Monitor, Task Manager or top.


Runtime.ObjectCount

ObjectCount As Integer

Returns the current number of objects in existence.

This property is read-only.

Method descriptions


Runtime.IterateObjects

IterateObjects As ObjectIterator

Iterates over the objects in the Runtime environment. Use it to get the TypeInfo for each object. See the ObjectIterator class for an example.


Runtime.ObjectClass

ObjectClass(index as Integer) As String

ObjectClass returns the class of the passed object.

This property is read-only.

The index must be greater than or equal to zero and less than the ObjectCount.


Runtime.ObjectID

ObjectID(index as Integer) As Integer

ObjectID returns a unique identifier for the passed object.

This property is read-only.

The index must be greater than or equal to zero and less than the ObjectCount.


Runtime.ObjectRefs

ObjectRefs(index as Integer) As Integer

ObjectRefs returns the number of references to the passed object.

This property is read-only.

The index must be greater than or equal to zero and less than the ObjectCount.

Sample code

The following code displays the properties related to individual objects in a multicolumn ListBox and the total amount of memory used in a TextField:

Var lastObjectIndex As Integer = Runtime.ObjectCount - 1
For i As Integer = 0 To lastObjectIndex
  Listbox1.AddRow(Runtime.ObjectID(i).ToString)
  Listbox1.CellTextAt(ListBox1.LastAddedRowIndex, 1) = Runtime.ObjectClass(i)
  Listbox1.CellTextAt(ListBox1.LastAddedRowIndex, 2) = Runtime.ObjectRefs(i).ToString
Next
TextField1.Text = Runtime.MemoryUsed.ToString

Compatibility

All project types on all supported operating systems.

See also

ObjectIterator class; System module.