Error information about your calculations in the global script causes about 40 bytes of memory leakage.
Errors in the global scrip can be detected in the log file. The fact that errors occur from time to time during the execution of the global script is not a big deal at first, but Basic writes information about the error into memory every time. Unfortunately, this information is not automatically released again (approx. 40 bytes per error).
For data point calculations, where a “real” basic function is created from the specified formula at runtime anyway, Elvis 2.1 inserts appropriate code to release the information. This does not work in the global script, since the complete function is written by you.
You can easily add an appropriate error handling yourself.
At the beginning of the OnDatapointChanged or OnInit function, insert the following code (download here):
On Error Goto ErrorHandler
If False Then ErrorHandler:
Print "Error in OnDatapointChanged: ", Err.Number, Err.Description
In the event of an error in the function, the jump label ErrorHandler is activated, which writes the information to the log file, releases the error information and aborts the function. The “If False Then” is used to ensure that the error code is not executed normally.