Share this page

# Example: lr_free_parameter

In the first example, the lr_free_parameter function deallocates the memory saved for the parameter Name. When trying to access the parameter after deallocation, a warning is issued.

In the second example, an array of parameters is released in a loop. The array was created with web_reg_save_param where Ord=All

## Example 1: Releasing a single parameter

// Create the parameter Name

lr_save_string("Fitzwilliam", "Name");

// Try to evaluate the string "Name" with parameter delimiters

lr_output_message(lr_eval_string("{Name}"));

// Free the memory allocated for the dynamic parameter "Name"

lr_free_parameter("Name");

// Try to re-evaluate the string "Name" with parameter delimiters

lr_output_message(lr_eval_string("{Name}"));

return 0;

Example: Output:

`vuser_init.c(9): Notify: Saving Parameter "Name = Fitzwilliam".`

`vuser_init.c(14): Notify: Parameter Substitution: parameter "Name" = "Fitzwilliam"`

`vuser_init.c(14): Fitzwilliam`

`vuser_init.c(18): Notify: Freeing Parameter 'Name'.`

`vuser_init.c(22): Warning: The string 'Name' with parameter delimiters is not a parameter.`

`vuser_init.c(22): {Name}`

## Example 2: Releasing an array of parameters

web_reg_save_param("test",

"LB=\"",

"RB=\" ",

"Ord=All",

LAST);

... any action function

i=atoi(lr_eval_string("{test_count}"));

while(i>0){

sprintf(buff, "test_%d", i); //Add index after "test_"

lr_free_parameter(buff); //Free parameter from array

i--;

}

Tips to improve your search results... VuGen Function Reference Version 25.1-25.3 Function Reference 25.1-25.3 All View Local Help Center View Online Help Center Version: