ReleaseMethod

Applies to:uCalc Transform
Class:uCalc
Releases a uCalc instance
Syntax
Release()
Remarks
When a uCalc instance is no longer needed, it can be released with this function. This releases all items associated with the uCalc instance.

Note: The uCalc object named uc, which is instantiated at startup (except in C#) should not be explicitely released. In C#, if there is only 1 uCalc object left, do not explicitely release it.

Note: A uCalc object must explicitely be released with Release for it to be released. A uCalc object is not automatically released from memory when the object goes out of scope.
Example 1: Doing an Eval in the same uCalc instance a variable belongs to

Dim uc1 As New uCalc
Dim uc2 As New uCalc

Dim x1 = uc1.DefineVariable("x = 5")
Dim x2 = uc2.DefineVariable("x = 6")

Console.WriteLine(x1.GetuCalc().Eval("x*10")) ' Returns 50: ' Same as uc1.Eval("x*10");
Console.WriteLine(x2.GetuCalc().Eval("x*10")) ' Returns 60: ' Same as uc2.Eval("x*10");

uc1.Release(): ' Since x1 is part of uc1, x1 is automatically released as well
uc2.Release(): ' Since x2 is part of uc2, x2 is automatically released as well

          

uCalc uc1 = New uCalc();
uCalc uc2 = New uCalc();

var x1 = uc1.DefineVariable("x = 5");
var x2 = uc2.DefineVariable("x = 6");

Console.WriteLine(x1.GetuCalc().Eval("x*10")); // Returns 50; // Same as uc1.Eval("x*10");
Console.WriteLine(x2.GetuCalc().Eval("x*10")); // Returns 60; // Same as uc2.Eval("x*10");

uc1.Release();  // Since x1 is part of uc1, x1 is automatically released as well
uc2.Release();  // Since x2 is part of uc2, x2 is automatically released as well

          

//uc1 uCalc.Create;;
//uc2 uCalc.Create;;

//var x1 = uc1.DefineVariable('x = 5');
//var x2 = uc2.DefineVariable('x = 6');

      WriteLn(x1.GetuCalc().Eval('x*10')); // Returns 50; // Same as uc1.Eval('x*10');
      WriteLn(x2.GetuCalc().Eval('x*10')); // Returns 60; // Same as uc2.Eval('x*10');

      uc1.Release();  // Since x1 is part of uc1, x1 is automatically released as well
      uc2.Release();  // Since x2 is part of uc2, x2 is automatically released as well

          

uCalc uc1;
uCalc uc2;

auto x1 = uc1.DefineVariable("x = 5");
auto x2 = uc2.DefineVariable("x = 6");

cout << x1.GetuCalc().Eval("x*10") << endl; // Returns 50; // Same as uc1.Eval("x*10");
cout << x2.GetuCalc().Eval("x*10") << endl; // Returns 60; // Same as uc2.Eval("x*10");

uc1.Release();  // Since x1 is part of uc1, x1 is automatically released as well
uc2.Release();  // Since x2 is part of uc2, x2 is automatically released as well

          

uCalc uc1;
uCalc uc2;

auto x1 = uc1.DefineVariable("x = 5");
auto x2 = uc2.DefineVariable("x = 6");

Console::WriteLine(x1.GetuCalc().Eval("x*10")); // Returns 50; // Same as uc1.Eval("x*10");
Console::WriteLine(x2.GetuCalc().Eval("x*10")); // Returns 60; // Same as uc2.Eval("x*10");

uc1.Release();  // Since x1 is part of uc1, x1 is automatically released as well
uc2.Release();  // Since x2 is part of uc2, x2 is automatically released as well

          
Prev | Next