Possible memory leak

Bug reports.
Marianne Jacobsen
Posts: 44
Joined: Fri Oct 26, 2007 1:18 pm

Possible memory leak

Post by Marianne Jacobsen » Wed Mar 17, 2010 1:58 pm

I've received some complaints about tests taking a lot of memory. In my pursuit to solve the memory problems I've come across something that might look like a leak in Ranorex.

Using an application that is never closed running the following code:

Code: Select all

using System;
using Ranorex;
using Ranorex.Core;

namespace ConsoleApplication2
{
    class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            Console.ReadLine();
            Mouse.DefaultMoveTime = 0;
            for (int i = 0; i < 1000; i++)
            {
                Element element;
                Form genie = "/form[@title~'SomeProgram']";
                genie.Activate();
                genie.TryFindSingle("/someranorexpath", 10000, out element);
                genie.TryFindSingle("/someotherranorexpaththatchangesprogramlayout", 10000, out element);
                Mouse.Click(element);
                genie.TryFindSingle("/someranorexpath", 10000, out element);
                genie.TryFindSingle("/someotherranorexpaththatchangesprogramlayout", 10000, out element);
                Mouse.Click(element);
            }
            Console.ReadLine();
        }
    }
}

I might be doing something wrong (quite possibly because of ignorance) :D Testing on an application with custom controls.

I ran the code through the ANTS Memory profiler and discovered that this seems to use an increasing amount of memory. After 5 minutes all heaps contain over 250MB of memory.
memoryconsumption.PNG
memoryconsumption.PNG (116.54 KiB) Viewed 1954 times
System.EventHandler.png
System.EventHandler.png (52.56 KiB) Viewed 1954 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Possible memory leak

Post by Support Team » Wed Mar 17, 2010 5:20 pm

Hi Marianne,

please can you post which Ranorex Version you are using.
Thanks

Regards,
Peter
Ranorex Support Team
.
Image

Marianne Jacobsen
Posts: 44
Joined: Fri Oct 26, 2007 1:18 pm

Re: Possible memory leak

Post by Marianne Jacobsen » Thu Mar 18, 2010 7:18 am

Yes I'm using Ranorex version 2.2.2. Any other information you want please don't hesitate to ask.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Possible memory leak

Post by Support Team » Thu Mar 18, 2010 11:13 am

Hi,

I've tried the same code you wrote with our VIP Application and i didn't get a Memory Leak. Please can you send ([email protected]) or post me your Application when it's possible. This would be great.

Thanks

Regards,
Peter
Ranorex Support Team
.
Image

Marianne Jacobsen
Posts: 44
Joined: Fri Oct 26, 2007 1:18 pm

Re: Possible memory leak

Post by Marianne Jacobsen » Thu Mar 18, 2010 11:28 am

I'm not sure that I'm allowed to send you a copy of our application under test. But maybe you could explain to me how our application would influence the memory consumption? Then I would have an easier task of explaining my supervisor why I should send you a copy.

Marianne Jacobsen
Posts: 44
Joined: Fri Oct 26, 2007 1:18 pm

Re: Possible memory leak

Post by Marianne Jacobsen » Thu Mar 18, 2010 1:28 pm

I believe that the problem is related to controls being disposed and recreated. Instead of delivering our application I've created a small example that mimics the behavior.

Use WindowsFormsApplication as application-under-test and ConsoleApplication to test it.
ConsoleApplication2.zip
(28.15 KiB) Downloaded 227 times
WindowsFormsApplication1.zip
(65.02 KiB) Downloaded 233 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Possible memory leak

Post by Support Team » Fri Mar 19, 2010 10:52 am

Hi Marianne,

You are right that the problem is related to controls being disposed and recreated.
Thanks for posting the bug. I've entered the Bug in our internal bug tracking tool and our developers will take a look on it.

Regards,
Peter
Ranorex Support Team
.
Image

Marianne Jacobsen
Posts: 44
Joined: Fri Oct 26, 2007 1:18 pm

Re: Possible memory leak

Post by Marianne Jacobsen » Fri Mar 19, 2010 1:18 pm

Hi Peter

No problem - happy that I could help (and that the leak isn't in my code :D ). I look forward to the fix.

Best,

Marianne

Marianne Jacobsen
Posts: 44
Joined: Fri Oct 26, 2007 1:18 pm

Re: Possible memory leak

Post by Marianne Jacobsen » Wed May 05, 2010 12:00 pm

Is this fixed in Ranorex 2.3?

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Possible memory leak

Post by Support Team » Thu May 06, 2010 5:18 pm

Hi!

Our developers are working on a solution. I think the leak will be solved in next Ranorex Release.

Regards,
Peter
Ranorex Support Team
.
Image

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Possible memory leak

Post by Support Team » Mon May 10, 2010 12:44 pm

We fixed a leak in the WinForms plugin with Ranorex V2.3.1. Please, download this latest release from our homepage:
http://www.ranorex.com/download.html

Regards,
Alex
Ranorex Team
.
Image

Marianne Jacobsen
Posts: 44
Joined: Fri Oct 26, 2007 1:18 pm

Re: Possible memory leak

Post by Marianne Jacobsen » Tue Aug 10, 2010 12:51 pm

Finally got around to retest this in our AUT - leak fixed.