/ Forums / Advansys Formativ / Creating Solutions with Formativ / When are variables in an applet unloaded? / Reply To: When are variables in an applet unloaded?

Support 1

    Thank you for your enquiry.

    In the following I have assumed that by “unloaded” you mean the memory used by a variable is deallocated or returned to the system. If this is not correct, please describe your technical requirement.

    The answer to your question depends on how the variables are used in an applet.

    The Formativ language is VBScript with extensions for working with the GroupWise APIs. A VBScript script/applet is executed by the Windows Scripting Host, and VBScript variables have the type Variant. The Variant type supports a number of subtypes, eg. integer, string, Boolean, Object (which could be a COM/OLE object). See the VBScript documentation for more information.

    In general, variables are deallocated when they go out of scope. Here are some example cases:

    • Local variable, ie. a variable declared inside a function/subroutine. Deallocation is automatic on exit from the function/subroutine.
    • Global variable, ie. a variable declared outside all functions/subroutines/classes. Deallocation is automatic on termination of the script.
    • Class variable, ie. a variable declared as a class member. Deallocation is automatic on deallocating an instance of the class.
    • A variable that is assigned using the set operator refers to an Object. More than one variable can refer to a single Object. Assigning nothing to the variable decrements the reference count for the Object, which will be deallocated when the count equals zero. Otherwise, the reference count is decremented automatically when the variable goes out of scope.
    • Formativ provides Utilities.TransferData which stores a string outside the scope of an applet. One applet can write to TransferData and another applet can read from TransferData. Its value is available for an entire GroupWise session: TransferData is deallocated when GroupWise shuts down. See the Formativ Language Guide for more information.

    I hope this helps.

    Advansys Support