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 a stable, session-unique integer that identifies a uCalc object, primarily for diagnostics and tracking object lifetimes.
The MemoryIndex method returns a predictable, sequential integer that uniquely identifies a uCalc object for the duration of an application session. It is an essential tool for debugging, logging, and understanding object lifetimes.
Unlike a Handle, which is a volatile, low-level memory address, the MemoryIndex is a stable, high-level identifier. It is assigned sequentially when an object is created.
MemoryIndex vs. HandleUnderstanding the difference between MemoryIndex and a Handle is crucial for effective diagnostics.
| Feature | MemoryIndex | Handle |
|---|---|---|
| Stability | Stable & Predictable. Incremental and consistent within a session. | Volatile. A raw memory address that changes between application runs. |
| Uniqueness | Unique for an object's lifetime. Can be recycled after release. | Guaranteed unique for the object's lifetime. Not recycled. |
| Purpose | High-level diagnostics, logging, and tracking object lifetimes. | Low-level object identification for the C++ core. |
A key behavior of MemoryIndex is that indices are recycled. When an object is released (either via Release() or by going out of scope if owned), its MemoryIndex is returned to an internal pool. The next object of the same type that is created will reuse that index. This behavior is a powerful diagnostic feature, as it allows you to verify that objects are being released as expected.
MemoryIndex to trace operations back to a specific uCalc engine, especially in multi-threaded or multi-instance scenarios.MemoryIndex values are reused later.GetHashCode(): While GetHashCode() provides an integer identifier, its primary purpose is for hashing in collections, and it is not guaranteed to be unique. MemoryIndex is guaranteed to be unique among all active objects of its type.MemoryIndex provides a predictable sequence (1, 2, 3, ...), making logs and test results easier to analyze.For the low-level, volatile identifier, see the Handle method.