Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

free the memory of object

shiva_suvarna
Participant
0 Kudos

hi friends

how can i free the memory of a object ex

( cl_dd_link_element ), the class cl_dd_link_element is not has a destructor

i freed the references of that object but the object is still occupying the memory through out the programm

i want to free the memory of that object in the middle of the programme itself.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Shiva,

If the object does not have a destructor, there's nothing that you can do about it. You have said that you have freed the references to that object. that is all you can do about it.

Garbage collection is automatic in ABAP. You cannot control it explicitly. If the object is occupying memory, then so long as it doesn't affect the program adversely, there's no harm.

Regards,

Anand Mandalika.

4 REPLIES 4

Former Member
0 Kudos

Hi,

U can try this out

IF NOT ( lobject IS INITIAL ).

CALL METHOD lobject->free

EXCEPTIONS

cntl_error = 1

cntl_system_error = 2

OTHERS = 3.

CLEAR: lobject.

PERFORM f9006_error_handle USING ptext.

ENDIF.

FORM f9006_error_handle USING value(ptext).

IF sy-subrc NE 0.

CALL FUNCTION 'POPUP_TO_INFORM'

EXPORTING

titel = text-e03

txt2 = sy-subrc

txt1 = ptext.

ENDIF.

ENDFORM. " f9006_error_handle

Thanks & Regards,

Judith.

Former Member
0 Kudos

Hi Shiva,

If the object does not have a destructor, there's nothing that you can do about it. You have said that you have freed the references to that object. that is all you can do about it.

Garbage collection is automatic in ABAP. You cannot control it explicitly. If the object is occupying memory, then so long as it doesn't affect the program adversely, there's no harm.

Regards,

Anand Mandalika.

0 Kudos

Hi,

Just another point that I can think of. If you are using a global object, is it possible for you to define the object reference as well as create the object inside a <i>subroutine</i> ? That is certainly a much surer way of ensuring the garbage collector gets to work as soon as possible.

Regards,

Anand Mandalika.

Former Member
0 Kudos

Have a look on the ABAP statement FREE...