Skip to Content
author's profile photo Former Member
Former Member

450Mb in an addon, how is it possible??

Hi.

I have a big problem developing addons.

When my addons starts, occupies 80mb RAM memory.

When user uses addon 3 or 4 hours my addon occupies 400 or 450Mb RAM memory.

I'm developing with VB.NET, it has 2 propierties very important

1. object's life is the block wich contain object. Ex:

        If pVal.ItemUID = "btnimport" Then
            If pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED Then
                If Not pVal.BeforeAction Then
                    Try
                        Dim oBP As SAPbobsCOM.BusinessPartners = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBusinessPartners)

                    Catch ex As Exception
                        SBOApp.MessageBox(ex.Message)
                    End Try
		'-> oBP doesn't exists because try block is end
                End If
            End If
        End If

2. VB.NET has an utility named "Garbage Collector" wich is running during program life and it clean all objects wich aren't used.

So VB.NET optimizes RAM memory.

Why my addon has 450Mb???

Shall it be because Company object is overloaded and doesn't release memory???

Exists any method for releasing Company memory??

Do you know some reasons for this wild growth???

SAP Spain said me "addons are addons"

Any comments will be thankful

Thnkx

Add a comment
10|10000 characters needed characters exceeded

Related questions

5 Answers

  • Best Answer
    Posted on Oct 18, 2006 at 02:12 PM

    Hi Juli,

    If your Add-On's memory usage keep growing and growing you've got a memory leak somewhere in your code. The only way to solve this is to ensure that you kill objects that you create. Also, don't leave dormant objects "laying around". Proper coding techniques include creating objects to do a task and then destroying them again. If you apply object oriented programming techniques, this should be no problem.

    Also you can look at optimising your code. The processing may take more memory into use, but once the processing is done this memory should be released.

    Never rely on the programming language to manage garbage collection - this will never work properly - it's based on rules which are not always appplicable. Once you've killed the object call GC.Collect to force the garbage collecter to run.

    Add a comment
    10|10000 characters needed characters exceeded

    • Buenas,

      Just some questions to identify where the problem is:

      - Does memory grow when you don´t use SBO?

      - Does memory grow when certain processes are done?

      - Have you got event filters?

      - Does the memory grow allways with the same size?

      - How much time does it take to grow until the 450MB?

      Regards,

      Ibai

  • Posted on Oct 18, 2006 at 04:19 PM

    The MB of memory used at the beginning are occupied when

    you connect to the company. But for what it concerns the

    400 M your solution occupies look like you have a leak in

    your application.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 18, 2006 at 06:02 PM

    Hi,

    I don't really trust the VB.NET Garbage Collector to handle things on it's own. I did in the beginning and had huge memory leaks. Once I started to explicitly clean up my objects and call the garbage collector everytime things worked much better.

    The SAPbobsCOM Objects such as RecordSets and business objects like the .BusinessPartners seem to love memory and did not get cleaned up that well, unless I explcitly told VB.NET to release them.

    Try the following couple of lines of code as soon as you are done with the object. This will release the object from VB.NET.

    'oRec is a RecordSet

    System.Runtime.InteropServices.Marshal.ReleaseComObject(oRec)

    GC.Collect()

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 25, 2006 at 02:20 PM

    What about profiling your add-on with some .NET memory

    profiling tool ? there are some available on the net.

    You should make the analysis that Ibai is suggesting,

    finding the scenarios that make your add-on leak,

    and then profile the execution and find the objects not

    released.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 23, 2006 at 10:17 PM

    SAP marketplace answer :

    _____________________________________________________________

    I have just received feedback from our development. The have advised

    us that this problem is now a candidate to be fixed in a future

    version. They have created note 1002513. This note has not been

    released yet, but will hopefully be released shortly.

    _____________________________________________________________

    Sébastien

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.