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: 

DataType

Returns the unique, stable index value that identifies the data type object within the uCalc engine.

Remarks

⚙️ MemoryIndex: Stable Object Identifier

The MemoryIndex method returns a stable, predictable integer that uniquely identifies a DataType object instance within its parent uCalc engine. This value is primarily used for advanced debugging and diagnostics, allowing you to track the lifecycle of objects.

💡 Key Characteristics

  • Stable & Predictable: Unlike the internal Handle, which can change between application runs, the MemoryIndex is assigned sequentially starting from 1. The special Empty object for each class is always assigned index 0.
  • Recycled on Release: When a DataType object is released, its MemoryIndex is returned to a pool. The next DataType object created will reuse that index. This behavior is crucial for detecting object leaks or verifying that objects are being released as expected.
  • Instance-Specific: The index is unique within a single uCalc instance. Two different uCalc instances will have their own independent sets of DataType objects, each with its own MemoryIndex sequence.

⚖️ Comparative Analysis: MemoryIndex vs. Other Identifiers

FeatureMemoryIndexHandleC# GetHashCode()C++ Pointer Address
StabilityStable. Predictable and sequential.Volatile. Changes between application runs.Unstable. Can change if an object is moved by the GC.Volatile. Changes on every run.
UniquenessUnique for the object's lifetime. Recycled after release.Guaranteed unique for the object's lifetime.Not guaranteed to be unique.Guaranteed unique.
PurposeHigh-level diagnostics and tracking object lifecycles.Low-level object identification for the C++ core.Hashing for collections.Direct memory access.

The primary advantage of MemoryIndex is for building diagnostic tools. You can log the index of an object at creation and verify that the same index is reused after you expect it to have been released, confirming your memory management logic is correct.

Examples