Skip to Content

Addon memory consumption

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Jul 03, 2017 at 04:06 PM

    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

    Add comment
    10|10000 characters needed characters exceeded