cancel
Showing results for 
Search instead for 
Did you mean: 

Addon memory consumption

Former Member
0 Kudos

Hello,

I've realised that every addon I've made is consuming a lot of memory. B1 client starts using about 300mb and suddenly it increases by 250mb when I start using my addons (550mb total). By commenting and uncommenting lines I found out that the line which is causing this is the following:

SAPbobsCOM.Company oCompany = (SAPbobsCOM.Company)Application.SBO_Application.Company.GetDICompany();

I added the following code at the end but nothing happened

System.Runtime.InteropServices.Marshal.FinalReleaseComObject(rs); //recordset
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(oCompany); //company object
rs = null;
oCompany = null;
GC.Collect();

I'm only worried about the memory. Performance is ok because my addons are quite simple.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member185682
Active Contributor

Hi Rudá,

Unfortunately this is common. If I'm not wrong there is no way to avoid this, this happen only with the first addon connection.

This code:

SAPbobsCOM.Company oCompany = (SAPbobsCOM.Company)Application.SBO_Application.Company.GetDICompany();

it is the better way to access the DI company object and avoid more memory increase, but if your add-on be the first add-on to initialize on the SBO your add-on will increase the memory. The next add-ons that use the same line of code, doesn't increase 250mb memory in your SBO, because they will reference an existing company object.

Maybe someone else have a better explanation.

Hope it helps.

Kind Regards,

Diego Lother