1.6 Clean Up Considerations for Heavy Usage Functions
A function's usage may be set in one of these ways:
- The Anticipated Usage of the process it is in.
- It contains a FUNCTION RDML command with OPTION *HEAVYUSAGE or *LIGHTUSAGE
- It executes the SET_FOR_HEAVYUSAGE or SET_FOR_LIGHTUSAGE Built-In Function
Note that each successive way overrides the previous ways. That is, a function may be in a LIGHT usage process but contains FUNCTION OPTIONS(... *HEAVYUSAGE ...) – it will be heavy usage. Likewise a function may contain FUNCTION OPTIONS(... *LIGHTUSAGE ...) but have executed the Built-In Function SET_FOR_HEAVYUSAGE – it will be heavy usage.
In general, the way to clean up the resources used by a heavy usage function is to call it again and have it execute the SET_FOR_LIGHT_USAGE Built-In Function. However this is not always possible, given the type of function that it may be.
- Functions CALLed or activated via CALL_SERVER_FUNCTION Built-In Function may use this mechanism to clean up. One suggestion would be to create a field for this and only exchange it when the heavy usage function is to clean up.
- Trigger functions could be coded to execute the SET_FOR_LIGHT_USAGE Built-In Function when called for the After Close event.
- RDML Built-In Functions can use this mechanism in their shutdown logic.
- The following functions cannot use this mechanism:
- System Variable Evaluation functions.