Web Vuser Functions (WEB) > Alphabetical List of Web Vuser Functions > web_js_reset

web_js_reset

Resets the JavaScript engine context for the Vuser.

C Language

int web_js_reset();
Example: web_js_run and web_js_reset Miscellaneous Functions

web_js_reset discards saved variables and objects and recovers the memory.

To run web_js_run and web_js_reset, Javascript must be enabled in the run time settings under Internet Protocol > Preferences > Options… > Web Javascript > Enable running Javascript code.

When the code called in a web_js_run step returns, the context is not discarded. Therefore, functions, objects, and variables remain in context and can be used in subsequent steps of web_js_run.

For example, if a function is defined in one web_js_run step, it can be used in a subsequent step without redefining it. In addition, if the function in a web_js_run step defines, calculates, or fetches some data, that data can be used again in a subsequent web_js_run step.

The convenience of preservation of context is offset by an increase in memory consumption. Since the JavaScript context is saved per Vuser, the memory consumption is not trivial when there are many web_js_run calls. You can call web_js_reset to clear this context for the Vuser, thereby recovering the memory. You can also call web_js_reset if you need to clear the values for logical reasons.

If the run-time setting Simulate a new user on each iteration is set, web_js_reset is called automatically at the start of each iteration. If Simulate a new user on each iteration is not set, avoid excessive memory consumption by inserting web_js_reset calls in your script at points where you no longer need the saved context.

Return Values

This function returns LR_PASS (0) on success, and LR_FAIL (1) on failure.

Parameterization

You cannot use standard parameterization for any arguments in this function.