Skip to Content

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 :


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



You must be Logged on to comment or reply to a post.
  • Hello Edy!

    I developed an add-on that uses 7 data tables in a thread. Each 1 second those data tables execute the method ExecuteQuery(), and 7 matrices load each DataTable. The memory increase continuously. I tried to use the method Clear(), but memory still in use. You know a way to resolve this? I’m using the SAP 9.1 PL 03.



    • Hi Marcel,

      I notice the behavior but have never tried to resolve this.

      In my original posting environment, the memory is only released after I clear up the data table and close the form.

      I am currently not able to test it on 9.1 because of my work load. Will definitely look at it again in my free time.