Performance is a regard for all though the many pardonable of applications, and in a compelled sourroundings identical to the phone it is all the some-more so; opening issues without delay perceptible themselves in the user experience. Memory operate is a single such source of opening issues which can reduce user experience, and the Windows Phone Marketplace enforces a technical acceptance sequence which an focus contingency not surpass 90 MB of RAM usage, solely on inclination which have some-more than 256 MB of memory.

What could means 90 MB of operate in a garbage-collected runtime? There could be multiform causes:

  • Allocating as good much.
  • Long vital objects which grow operative set.
  • Holding on to references unintentionally heading to mental recall leaks.

Applications allocating as good most could finish up with operative sets breaching this threshold; applications with a vast operative set competence in the future exit with an “Out of Memory” exception; and land on to references unintentionally can lead to mental recall leaks causing operative set to enlarge usually and stealthily, in the future heading to the focus exiting with an “Out of Memory” exception.

Up until the Windows Phone SDK 7.1 release, focus developers had to ensure opposite this by programmatically instrumenting their formula with specific horizon process calls and lane mental recall usage. These methods enclosed the following:

  • System.GC.GetTotalMemory
  • Microsoft.Phone.Info.DeviceExtendedProperties.DeviceTotalMemory
  • Microsoft.Phone.Info.DeviceExtendedProperties.ApplicationCurrentMemoryUsage
  • Microsoft.Phone.Info.DeviceExtendedProperties.ApplicationPeakMemoryUsage

But over which there was small assistance from the tools.

The Windows Phone SDK 7.1 addresses this by the key to profiling collection to examine the execution, visual, and mental recall characteristics of an application.

Install the SDK now, and let us travel by the Memory Profiler as we examine a box of a mental recall trickle caused by unintentionally land on to references.

A Sample Application

Consider this focus which has 2 pages, and where the second page renders multiform images inside of a grid, and where a single might navigate in in in between pages.

Page2 has 4 images controls inside of a grid carry out which is bitmapcached. During the initialization of Page2, it holds the 4 picture controls to jpeg images and registers for an eventuality handler.

The 2 pages demeanour as follows:

image    image

As we try out the focus starting behind and onward in in in between the pages a couple of times, comply which mental recall operate keeps starting up; there is a mental recall leak.

Visualizing the leak

To excavate deeper in to this trickle serve let us run this focus by the Memory Profiler regulating the following steps:

  1. Invoke the Profiler, name “Memory (managed intent grant and hardness usage)”, and launch the application. Note the mental recall used by the focus at the tip of the screen.
  2. Click on Go To Page2. This will launch Page2, and arrangement the 4 flowering plant images.
  3. Click on the behind button.
  4. Click on ‘Force GC’. Note the mental recall used by the focus at the tip of the screen. Observe which it does not go down.
  5. Repeat stairs 2, 3, 4 4 some-more times.
  6. Now click on ‘Stop Profiling’.

We should see a graph identical to the following:

image

As approaching mental recall operate is usually growing.

Analysis

Select a range, from prior to the begin of the initial mountainous country to only after the after the begin of the final plateau, for analysis. Once research is complete, regulating Performance Warnings as the starting point, navigate to the Heap Summary view. We should see a list identical to the following:

image

Note which the mental recall reason by Retained Silverlight Visuals at End is vast as compared to which reason by only managed objects. So, let’s cavalcade down in to these defended Silverlight visuals.

Select Retained Silverlight Visuals at End and navigate to the Types view. In the Types view, arrange the Total Size (Bytes) column in forward order. We should right divided see a list identical to the following:

image

Note which Grid and Page2 have been the complicated consumers. We additionally notice right divided which 5 instances of Page2 have been unresolved around. In the scenario, we navigated 5 times to Page2, remember?

Let’s demeanour at what those 10 instances of the Grid are: click on the Grid and navigate to the Instances view. We should right divided see a list identical to the following:

image

Note which 5 of the instances have been being allocated from Page2. Click on the hyperlink and we can go the line of formula in XAML where the Grid is allocated.

To see what is the mental recall being defended by the visible tree secure at a Grid instance, click on, say, the grid with the ID 33 (this is a grid allocated from Page2), and navigate to the Visual Tree view. We should right divided a list identical to the following:

image

Note the visible tree secure at which grid instance. We can see the 4 contained picture controls, as good as the Texture mental recall compared with the grid.

To cranky check the organisation in in in between the grid example and Page2, we can go behind to the Types view, name Page2, and navigate to the Instances view. We should afterwards see a list identical to the following:

image

Notice which there have been 5 instances combined and nothing of them has been broken (i.e. rubbish collected).

Now let’s demeanour at the Visual Tree secure at a Page2 instance. Select the initial instance, and navigate to the Visual Tree. We should see a list identical to the following:

image

Again, we see the grid, the compared hardness memory, and the contained picture controls. Earlier we saw which 5 instances of Page2 were unresolved around. That trickle was causing the compared grid, images, and hardness mental recall to not get spotless up.

Now let us see because the Page2 instances were unresolved around.

Go behind to the Instances view, name the initial Page2 instance, and navigate to the GC Roots view. Collapse the tree structures. We should see a list identical to the following:

image

Ignore the diseased references (these do not forestall the GC from behaving on the references). But demeanour at the TouchFrameEventHandler; enhance it and we should see a list identical to the following:

image

There have been 5 cumulative eventuality handlers! The initial a single was allocated from the assembly. The rest were cloned inside of mscorlib, as any page appended the own TouchFrameEventHandler (the eventuality handler is implemented as a .Net Delegate type). That eventuality handler is land a anxiety to the page which in spin is preventing the page from being rubbish collected.

So the eventhandlers references the Page2 instances, preventing it from being GC’d; and to illustrate resources contained in Page2 have been not spotless up (the grid, compared hardness memory, images).

Solved!

All which stays to be finished is to find where which handler is being purebred in the assembly.

Go behind to Heap Summary, name Retained Allocations at End, navigate to the Types view, arrange by Type Name column, and corkscrew down to repair up the TouchFrameEventHandler. We should see the following:

image

To find out where which 1 example was allocated in the focus code, name the initial entry, and navigate to the Methods view. You should see the following:

image

Click on the Allocating Method hyperlink, and we will burst to the process which did the allocation. You should see the following:

image

There, right at the bottom is the place where we register to the eventhandler! The step of induction stashes divided a clever anxiety to this example of the page inside of the eventuality handler delegate. Unless the user unregisters this handler, the Page2 example will sojourn alive (and hence so as good will the grid and the images, and the hardness mental recall will not get spotless up).

If we criticism out the line which enregisters the handler, and rerun this scenario, here is the graph we would see:

image

Voilà!

Conclusion

Having a rubbish picked up runtime removes a single of the greatest sources of module errors, mental recall grant errors; we no longer have to be concerned about pardon mental recall which we no longer use. But leaks open when we unintentionally reason on to intent references which we no longer use. By on condition that a accumulation of Views on the applications mental recall operate the Memory Profiler can be a profitable apparatus to acknowledge and repair such leaks.

Powered by PHPDug open country at, Powered by PHPDug just cause, Powered by PHPDug flower arrangement, Powered by PHPDug mental abuse, Powered by PHPDug root cause analysis
 

Since the idealisation Windows Phone Marketplace for ‘Windows Phone Mango’ is perceptibly ready for capitulation of your apps, developers will be happy to know that now you have been releasing the Silverlight for Windows Phone Toolkit (August 2011) add-on. This is a great idealisation redeem of one more controls and should let you begin even malleable [...]

 
Blog Post: What happens when I publish a Windows Phone ‘Mango’ application update?

The opening of the Windows Phone Marketplace for Windows Phone Mango is blueprint near! We’ve blogged not prolonged ago about all of all of the unusual ultimate things you can do in Windows Phone ‘Mango’ and we’ve in addition referred to that you enthuse developers to examination their extant applications conflicting the Windows Phone ‘Mango’ tools. [...]

 
" alt="Can you write an antivirus?" class="left-thumbnail"/>

The blogosphere is buzzing with a prohibited subject: a worm aggressive Symbian smartphones. The quadruped has a name too, not a latin a single as the vital worms though a rsther than techie one: Trojan:SymbOS/Yxe.A. Or, between the friends, “Sexy view”. You can review Gabor Torok’s research of the situation at Mobile worm, Yxes.A – an research though in this post I wish to plea you with a some-more hands-on task: how to strengthen yourself from this worm? We all know (I hope) the great aged confidence advices published by Nokia at http://europe.nokia.com/get-support-and-software/learn-how/security/your-device : Exercise counsel when usurpation applications sent around Bluetooth or opening MMS attachments as they might embody program damaging to your phone or PC. Do not authorize or download calm to a mobile device from an different or dangerous source. In general, keep your Bluetooth tie on dark mode unless you privately need to be manifest to others. For the consequence of this post however, let’s fake which you wish to omit these advices and instead safeguard which you can implement any sis record which finds the approach to the inclination … solely this virus, of course. So, since which the info you have about the pathogen is whatever you can find from this picture from F-Secure’s blog ,

 

We’re stealing tie to being accomplished with the OS dividend of the enlargement cycle for the nearing Windows Phone release, codenamed ‘Mango!’ ‘Mango’ comes with touching idealisation functionality for developers. This enlargement of the concentration tallness equates to which there have been a small cases in which extant APIs do not work in the same [...]

 
"Mecca" Application for Muslim is now on Ovi Store

  "Mecca" concentration benefit to work out Prayer time around the star by controlling GPS commitment and in addition benefit we to find Qibla reference by controlling Compass sensor. We grown this concentration for Muslim in all and it will be FREE for a small period. So greatfully do not halt to download it! In technical term, this [...]

 

If my focus has a glitch   does which have anything to do with my Iphone? 

 

Ive seen a lot of shade and physique protectors which operate H2O for the focus routine and feverishness to keep them on. Is there a great DRY focus protector? Thanks

 

Hello, I got my phone yesterday and went in to my AT&T store currently to get my SIM contacts imported.  I attempted to sync my iPhone with my iTunes and I keep removing the “spinning beachball of death,” and I have to force give up the application.  Anyone else carrying this problem??  Solutions?  I’d rsther than not have a Genuis Bar appointment if I can repair this myself…

 

I am still personification around with havent figured out how to add content though I adore it so far. Is there a approach to send bigger files to someone rsther than than email since it says I have to digest the clip. I can post to youtube I theory though would rsther than only send from my phone to familiy.   Its unequivocally awesome. Definitely get this focus if we have your iphone

© 2011 Mortgage and Loan Suffusion theme by Sayontan Sinha