‎2009 Jun 03 3:37 PM
Hello,
when using data-references double memory consumption seems to be unavoidable:
In the following example, we take the fm-parameter table_to_display (without any type) and convert it into a dynamically created internal table.
DATA: tab_ref type ref to data.
field-symbols: <g_outtab> type standard table.
CREATE DATA tab_ref TYPE STANDARD TABLE OF (p_structure).
ASSIGN tab_ref->* TO <g_outtab>.
LOOP AT table_to_display ASSIGNING <wa_outtab>.
lv_tabix = sy-tabix.
APPEND <wa_outtab> TO <g_outtab>.
DELETE table_to_display INDEX lv_tabix.
ENDLOOP.
ENDIF.
REFRESH table_to_display[].
When starting the program and analysing the memory in the debugger tab_ref and <g_outtab> both allocate (nearly) the same memory.
If we have large lists, we sometimes run out of memory.
Does anybody know, how to release one of the data objects?
Thanks in advance
kind regards
Olaf
‎2009 Jun 03 6:25 PM
As far as I can tell, the problem isn't because you're using a data reference, it's because you're using two different tables, one to store the data and one to display the data. Presumably in the real world, the display is slightly different from the driver table, because otherwise you should just display the driver and not have a second table (or data reference).
That said, I haven't found a good way to do it - the DELETE doesn't lessen the memory footprint. I believe the FREE statement does - but by the time you could use it, you've already hit the memory limit (ie, outside the loop).
‎2009 Jun 03 6:25 PM
As far as I can tell, the problem isn't because you're using a data reference, it's because you're using two different tables, one to store the data and one to display the data. Presumably in the real world, the display is slightly different from the driver table, because otherwise you should just display the driver and not have a second table (or data reference).
That said, I haven't found a good way to do it - the DELETE doesn't lessen the memory footprint. I believe the FREE statement does - but by the time you could use it, you've already hit the memory limit (ie, outside the loop).