A_FREE

Syntax

A_FREE( arr );
Input arguments
handle arr Handle of the array.

Description

This function deallocates the memory that has been allocated for an array. In the current implementation, it is the script writer's responsibility to free arrays when they are no longer used.

Example

A_FREE assigns a null handle (data type=handle, value=0) to the array handle, when the array is freed. Thus the correct way to test its value after A_FREE in the code is as follows:

Copy
array_h=A_ALLOC(10);
...
A_FREE( array_h );
....
if(array_h == 0){
...
}

Note that the following is wrong, because the type of the variable is still handle, and not integer:

Copy
if(ISINT(array_h)){
...
}

This is a little bit confusing since many of the interactive functions which on success return a handle (e.g. PM_DEFINE_SET) return an integer 0 if the user cancels them, and they should be tested with ISINT.