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.
Release
Method
Product:
Class:
Unregisters a custom data type and releases its associated resources from the uCalc instance.
Syntax
Parameters
Return
void
This method does not return a value.
Remarks
💾 Releasing a Data Type
This method manually removes a custom data type definition from its parent uCalc instance. Releasing a data type frees up its associated memory and makes its name available for reuse.
When to Use Release
While not frequently needed, manually releasing a data type is useful in specific scenarios:
- Dynamic Environments: In applications where data types are created and destroyed dynamically,
Releaseallows for precise control over the parser's state and memory usage. - Un-shadowing Definitions: If you define a new data type with the same name as an existing one, the new definition "shadows" the old one. Releasing the new data type will restore the previous definition. See the practical example below.
- Resource Management: For long-running server applications or plugins, explicitly releasing unused definitions can prevent memory bloat over time.
Automatic vs. Manual Release
It's important to understand uCalc's resource management model. All objects created within a uCalc instance (including functions, variables, and data types) are owned by that instance.
- Automatic Release: When you call uCalc.Release on the parent
uCalcobject, all associated data types are automatically released. This is the most common and safest way to clean up resources. - Manual Release: Calling
myDataType.Release()provides granular control but requires you to manage the object's lifecycle carefully.
This model is analogous to RAII (Resource Acquisition Is Initialization) in C++, where object lifetime is tied to scope. The uCalc object acts as the scope for all its definitions.
⚠️ Caution
- Built-in Types: Do not attempt to release built-in data types like
String,Int, orDouble. - In-Use Types: Releasing a data type that is currently being used by a variable, function return type, or expression can lead to errors or undefined behavior. Ensure that all items referencing the data type are released before releasing the data type itself.