Skip to Content
0
May 03, 2016 at 01:33 PM

Memory leak in UI-API LoadBatchActions() ?

132 Views

Hello SCN, this is my first post so please be forgivin' 😉

I created a rather complex form for my SBO Addon which is working quite well so far. The resulting XML had about 150KiB and I am using the UI-API method LoadBatchActions(string) to create and change forms.

A couple of days ago I recognized a memory leak within the "SAP Business One.exe". Whenever I open and close this form the memory consumption of the SBO process (private bytes) raises about 15MiB. Nothing is done on the form, just open (search mode) and close. I can repeat this until I ran out of memory.

I analyzed the problem and found out that the culprit is actually the call to LoadBatchActions(string) in managed code leading to this memory leak in unmanaged code. While debugging it is exactly this line of code that leads to memory allocation. After form creation, LoadBatchActions(string) is called twice again to change the form (another UI-API problem worth another discussion...), but this has nearly zero influence on memory usage.

I first thought the Forms object is not released/disposed after closing, but I double checked that. I even recognized that this is happening almost with every form I create, it's just not that obvious/heavy. I also tried the alternative FormCreationParams/AddEx methods, but besides not being able to change forms with this method combinations the leak is still there...

Anybody any idea what I am doing wrong? How can one release the memory again (w/o restarting SBO)?

My environment: C# 4.0, SBO 9.1 PL10, MSSQL 2014

Thanks in advance for any helpful answer!