After using a dynamic temp-table, you should delete it as you should any other object. Use the DELETE OBJECT tt-handle statement to do this. The default buffer is also deleted. You cannot use the DELETE OBJECT statement on the temp-table’s DEFAULT-BUFFER-HANDLE, but you must use it on any additional dynamic buffers created for the temp-table.

When you pass a dynamic temp-table as a parameter, and you then delete the dynamic temp-table, the AVM executes the deletion differently depending on whether the temp-table parameter is passed with OUTPUT, INPUT-OUTPUT, or INPUT mode:
  • OUTPUT or INPUT-OUTPUT mode — The DELETE OBJECT statement for the temp-table is intercepted and marked as pending during the called procedure. The temp-table is deleted just after the called procedure returns, once the parameter hand-off is complete.
  • INPUT mode — The DELETE OBJECT statement for the temp-table executes immediately when encountered as there is no need to preserve the temp-table for parameter hand-off.
Note: To avoid memory leaks, you should always use the DELETE OBJECT statement to delete the dynamic temp-table created by an OUTPUT TABLE-HANDLE parameter.

For more information about passing dynamic temp-tables as parameters, see the Use a temp-table as a parameter section.