uCalc API Version: 2.1.3-preview.2 Released: 6/16/2026

Warning

uCalc API Preview Release Notice:The documentation describes the intended behavior of the API. The current preview build contains incomplete features, unoptimized performance, and is subject to breaking changes.

MemoryIndex = [int]

Property

Product: 

Fast Math Parser

Class: 

Item

Returns a stable, predictable index for the object, useful for diagnostics and tracking object lifecycles.

Remarks

The MemoryIndex method returns a stable, predictable integer that uniquely identifies an object within its class for the duration of its lifetime. It is primarily a tool for advanced debugging, diagnostics, and tracking object lifecycles.

Key Characteristics

  • Predictable: Unlike a memory address, the MemoryIndex is assigned sequentially. The first Item created will have index 1, the second will have index 2, and so on.
  • Stable: The index of an object will not change during its lifetime.
  • Recycled: When an object is released (e.g., via .Release()), its MemoryIndex is returned to a pool and will be reused by the next object of the same type that is created. This is a key behavior to understand when debugging.

MemoryIndex vs. Handle

It is crucial to distinguish MemoryIndex from an object's Handle.

FeatureMemoryIndexHandle
StabilityStable & Predictable. Sequential integers.Volatile. A memory address that changes between runs.
UniquenessUnique for its lifetime, but recycled after release.Guaranteed unique for the object's lifetime. Never recycled.
PurposeHigh-level diagnostics, logging, lifecycle tracking.Low-level object identification for the C++ core.
Use Case"Is this the same object slot I saw before?""What is the exact memory reference for this object?"

💡 Why uCalc? (Comparative Analysis)

  • vs. C# GetHashCode(): While GetHashCode() provides an integer, it is not guaranteed to be unique, nor is it stable between application runs. MemoryIndex is deterministic and predictable within a single run.
  • vs. C++ Pointers: A raw pointer address in C++ is volatile, similar to uCalc's Handle. MemoryIndex provides a higher-level, more stable identifier that is independent of memory layout.

The MemoryIndex gives developers a reliable tool for introspection that bridges the gap between low-level memory addresses and high-level object references.

Examples