Feedback
Add System.AllocationCount for measuring VM object allocations
- Status
- Accepted
- Fixed in
- -
- Source discussion
- -
- Last updated
- 2026-08-30
Upvotes
2 upvotes
Uses your Objo forum account.
Public summary
Add a shared System.AllocationCount property that reports the lifetime number of objects the virtual machine has allocated.
The counter includes class instances, arrays, dictionaries, closures, and runtime strings, and it never decreases. Reading it before and after a code region shows how many objects that region created, which makes it possible to verify that hot code (for example a physics step or a rendering loop) runs without allocating.
Var before As Integer = System.AllocationCount
RunSimulation()
Var after As Integer = System.AllocationCount
Print(after - before)