FREE - Resets a data object to its original value and releases the resources it occupied.


FREE f has the same effect as CLEAR f, namely that a Data object f is reset to the initial value corresponding to its type.

Unlike CLEAR, FREE also releases any resources taken up by the data object f. This can be important with internal tables , structures containing tables, and table work areas (created using TABLES).

After FREE f , the data object f can be re-addressed at any time. The only condition is that you may need to re-allocate resources to the object.


If f is an internal table with header line (where the name f in a sense has two meanings) the statement FREE f refers to the body of the table, and the statement CLEAR f refers to the header line.

The runtime required to reset an internal table and free its resources depends how much memory the internal table has been occupying.
To reset a small internal table takes around 80 msn (standard microseconds), a 200 KB table takes around 700 msn, and a 1 MB table around 3500 msn.
If the table has an index or hash table (because it was created using INSERT, DELETE or SORT, or edited using COLLECT ), the runtime increases, since the index or hash table also need to be released.