Memory Leak on Form DataTable: The other day, I was developing an add on for one of our customer.

The customization requires me to load a considerable amount of data into a datatable bound to a matrix.

I noticed on my computer memory usage that each time I open the form, the SBO (not the customized program) memory usage increases.

This make sense, since i am reading a lot of data from the tables and dump them into my form datasource.

However, when I close the form, the memory are not fully released.

Each and everytime i open and close the form, the SBO memory usage is getting bigger and bigger.

After some debugging, I found out that the memory from the DataTable object is not released.

The solution for this is quite simple.

Catch the Before Form Closed event. and call this :

oform.DataSources.DataTables.Item(“UID”).Clear()

Observing the life cycle of form creation.

1. Create Form

2. Add DataSource.

3. Bind DataSource.

4. Initialize the Form.

5. Users interact with the form.

6. Close form,

I think it is a good practice to add one step in between point 5 and 6, which is Clean Up the DataSources.

Note :

My Development system was :

Windows XP SP3

SBO 882 PL 8

Regards

Edy

New NetWeaver Information at SAP.com

Very Helpfull

 

 

User Rating: Be the first one !