uCalc API Version: 5.7.0-preview.1 Released: 7/30/2026
Warning
uCalc API Preview Release Notice:This preview documentation describes the intended behavior of the API. It is not fully accurate or complete.The current preview build contains incomplete features, unoptimized performance, and is subject to breaking changes.Use of the preview version in your production code is not recommended.
Product:
Class:
Returns the unique, stable index value that identifies the data type object within the uCalc engine.
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.
MemoryIndex is assigned sequentially starting from 1. The special Empty object for each class is always assigned index 0.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.uCalc instances will have their own independent sets of DataType objects, each with its own MemoryIndex sequence.MemoryIndex vs. Other Identifiers| Feature | MemoryIndex | Handle | C# GetHashCode() | C++ Pointer Address |
|---|---|---|---|---|
| Stability | Stable. Predictable and sequential. | Volatile. Changes between application runs. | Unstable. Can change if an object is moved by the GC. | Volatile. Changes on every run. |
| Uniqueness | Unique for the object's lifetime. Recycled after release. | Guaranteed unique for the object's lifetime. | Not guaranteed to be unique. | Guaranteed unique. |
| Purpose | High-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.