Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing Internal Data →  Assignments →  Initializations 

FREE

Quick Reference

Other versions: 7.31 | 7.40 | 7.54

Syntax


FREE dobj. 

Effect

The statement FREE deletes all rows from an internal table and releases the memory area that the rows occupied.

On other data objects, FREE works like the statement CLEAR.

If dobj is a structure with table-like components, the memory of all the table-like components is released.


Notes

  • If dobj is an internal table with a header line, FREE is only applied to the table body and not the header line.
  • Unlike CLEAR, the initial memory area (see INITIAL SIZE) remains unoccupied when FREE is used. This can become necessary when there is a lack of memory.
  • In general, FREE should be used only if the entire memory is to be released in full and the internal table is no longer needed (or at the least not filled again right away).
  • See also Memory Requirements of Deep Data Objects.

Example

At the breakpoints in the memory analysis of the ABAP debugger, it is clear that FREE frees up more allocated bound memory than CLEAR.

DATA itab TYPE STANDARD TABLE OF i WITH EMPTY KEY 
          INITIAL SIZE 10000. 

itab = VALUE #( FOR i = 1 UNTIL i > 10000 ( i ) ). 

CLEAR itab. 
BREAK-POINT. 

FREE itab. 
BREAK-POINT.