Memory Leak in Target Silverlight App via AutomatonPeer objs

Bug reports.
tringhamj
Posts: 2
Joined: Thu Nov 13, 2014 1:05 pm

Re: Memory Leak in Target Silverlight App via AutomatonPeer objs

Post by tringhamj » Tue Nov 25, 2014 12:11 pm

Hi Alex,
* When you debug your application, you see that AutomationPeer objects are staying behind?
After recording or playing back with Ranorex, yes. Without it, there are no AutomationPeer objects being created. Even several minutes after Ranorex has stopped there are still thousands of AutomationPeer objects.
* And you do not see those objects if you manually perform the same steps you do aut
mated?
No, only after and during recording / automating. When doing it manually the memory stays stable.
* Is there any other software running that could also use UIA and cause the object to not be released? E.g. screen narrator, accessibility or automation software, anti-virus program, ...? (This blog points out that the Tablet PC Input Services can also cause AutomationPeer objects not to be cleaned up.)
Not that we are aware of - the problem has been reproduced on virtual and real machines, on a variety of setups and versions of Windows. We've been looking into this but haven't found any likely program so far, but we'll keep looking. There aren't any tablet services running, but just in case I followed this: msdn.microsoft dot com/en-us/library/dd901337(v=VS.90).aspx (replace 'dot' with a '.' - I'm not allowed to post URL's) to disable Tablet support (no effect).
* You may want to start your OS in protected mode and try to reproduce the leak again to rule out influence of other software...
We've tried it in safe mode (in Windows Server 2008), the leak still occurred.
* In the original post, Mark mentioned you start the Silverlight app "with elevated permissions". Have you tried running it with default permissions? Is Ranorex running with the same rights?
Taking away elevated permissions doesn't seem to make a difference, the leak still appears. Elevated permissions is a Silverlight property and so we can't run Ranorex with it - however, running Ranorex as an administrator also doesn't seem to make a difference.

If it's possible, could you inspect the Manager Peer Dictionary in your profiler and examine the Automation Peer objects (as you're not experiencing the leak you may have to do this during the automation while the AutomationPeers haven't been GC'd yet). Looking at ours, the majority of elements in the dictionary are weakly referenced, but all AutomationPeer objects are ManagedObjectReferences - are you also seeing this?

Thanks,
John

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Memory Leak in Target Silverlight App via AutomatonPeer objs

Post by Support Team » Mon Dec 01, 2014 5:58 pm

tringhamj wrote:Looking at ours, the majority of elements in the dictionary are weakly referenced, but all AutomationPeer objects are ManagedObjectReferences - are you also seeing this?
Yes, I'm seeing the same behavior. According to the instance retention graph, the weakly held references are the ones coming from your DataGridCell UI controls.
The non-weakly held objects seem to come directly from the framework (static objects?). The retention graphs reports them to be held by System.Object.

Regards,
Alex
Ranorex Team