Showing results 1 to 5 of 5

Thread: Memoryleaks

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    28.10.2020
    Posts
    10

    Default Memoryleaks

    Hello!

    We are running several Addins in our Runtimes and we are always experiencing a slow rising RAM usage from the runtime when have addins active. Anyone else experienced that issue aswell?
    When analyzing the Memory, it showed us only ~10MB used by our addins while the RT was at around 500-1GB of RAM (99% of it "unmanaged Memory").

    More in-depth analysis showed, that the Runtime is generating TONS of finalizable objects. The highest logged was at around 5 Million objects, sadly we could only investigate several snapshots which had around 1000-8000 queued finalizable objects which had the type: "InteropSponsor" and "VariableAdapter". Both from the ScadaAddin Library.


    I guess this could cause the memory leak? Why are this objects created and why are there millions of them generated over several hours?

    Could it be caused by looping through all available RT variables?


    Thanks in advance!

    Best Regards and stay safe!
    Markus

  2. #2
    Join Date
    28.02.2013
    Posts
    222

    Default Re: Memoryleaks

    Hi Markus,

    what are you doing in your AddIn?
    Can you share the code? At least the sections that access the zenonAPI?
    Maybe you are creating objects and never deleting them?

    Regards,
    Felix

    Quote Originally Posted by VCmarkus View Post
    Hello!



    We are running several Addins in our Runtimes and we are always experiencing a slow rising RAM usage from the runtime when have addins active. Anyone else experienced that issue aswell?

    When analyzing the Memory, it showed us only ~10MB used by our addins while the RT was at around 500-1GB of RAM (99% of it "unmanaged Memory").



    More in-depth analysis showed, that the Runtime is generating TONS of finalizable objects. The highest logged was at around 5 Million objects, sadly we could only investigate several snapshots which had around 1000-8000 queued finalizable objects which had the type: "InteropSponsor" and "VariableAdapter". Both from the ScadaAddin Library.





    I guess this could cause the memory leak? Why are this objects created and why are there millions of them generated over several hours?



    Could it be caused by looping through all available RT variables?





    Thanks in advance!



    Best Regards and stay safe!

    Markus


  3. #3
    Join Date
    28.10.2020
    Posts
    10

    Default Re: Memoryleaks

    Hello Felix,

    The Addins we are using are a bit too big for posting in here, but basically this is the only way i am accessing te zenonAPI. Maybe calling the API like this multiple times per minute causes leaks somehow?

    public static T LoadVariable(IProject project, string name, ref ErrorLog errorLog)
    {
    string value = "";

    try
    {
    if (project.VariableCollection[name].IsOnline)
    value = project.VariableCollection[name].GetValue(0).ToString();
    else
    errorLog.Add(name + "Offline");

    if (value == "")
    errorLog.Add(name + "(Empty)");
    }
    catch (Exception ex)
    {
    errorLog.Add("Failed to read value: " + name);
    }

    if (typeof(T) == typeof(bool))
    return (T)Convert.ChangeType(int.Parse(value == "" ? "0" : value), typeof(T));
    else
    return (T)Convert.ChangeType(value, typeof(T));
    }


    Quote Originally Posted by felixst View Post
    Hi Markus,

    what are you doing in your AddIn?
    Can you share the code? At least the sections that access the zenonAPI?
    Maybe you are creating objects and never deleting them?

    Regards,
    Felix




  4. #4
    Join Date
    28.02.2013
    Posts
    222

    Default Re: Memoryleaks

    Hi VCmarkus,

    in this snippet I don't see anything that should cause rising memory consumption.
    What zenon version and build number are you using?

    I suggest to contact your local COPA-DATA support in order to discuss deeper analysis options.

    Regards,
    Felix

  5. #5
    Join Date
    28.10.2020
    Posts
    10

    Default Re: Memoryleaks

    Hey!

    I think we were running Zenon 8.20 65486 at that time. I will send a ticket.
    Are there any special calls which can cause a leak at the moment? So i can crosscheck those options with the code?


    Thanks
    Markus

    Quote Originally Posted by felixst View Post
    Hi VCmarkus,

    in this snippet I don't see anything that should cause rising memory consumption.
    What zenon version and build number are you using?

    I suggest to contact your local COPA-DATA support in order to discuss deeper analysis options.

    Regards,
    Felix

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •