I have a Windows Phone 7.5 / Silverlight App.
Each page has 4-5 images, 4-5 storyboard animations and 2 textblocks. It also has 2-3 soundEffects.
User can navigate from page1 to page 15. As soon as I reach page 10 the memory consumption goes beyond 90MB, which is the limit.
I read this: http://windowsteamblog.com/windows_phone/b/wpdev/archive/2012/02/01/memory-profiling-for-application-performance.aspx but I am not able to determine exactly what is wrong in my app.
I want to push this app as beta asap but it is failing on Peak Memory Consumption Test when I run Marketplace Test Kit.
Any other pointers or resources?
Thanks.
Added Images:
There are 18 instances of Grid, which is one per page. Is it ok to have an instace of grid to be in the memory even if I have navigated away from the page?
Updated - Profiler snapshot when memory is above 90Mb: Also as I noted each of my page is in the memory and not sure from where 46 grid instance come from. I have also added GC.Collect when I move to next page. Not sure if that matters.
Updated -Link to code for a control that allow to go to nextpage: http://pastebin.com/ZnBaWfZU
I had to re-work my navigation since each page was left behind in the backstack, it was taking up the memory.
Here are few things I did:
1: In the OnNavigateFrom, I had to stop all the animations and set them to null. Same thing for all SoundEffects. Disposed the SoundEffectInstances.
2: In the OnNavigatedTo, I manually calle NavigateService.RemoveBackEntry() to remove the page from backstack and then call GC.Collect().
Hope this helps. Feel free to comment if there's anything wrong using the above solution.
Related
i have a meteor project (web not app) and when i view the site on my iphone over wifi it works great, but when i view the site over LTE i see a white page or sometimes a black page. this implies to me that the site is taking too long to download too much so the browser is giving up. (maybe i'm in left field)
so, i was wondering if anyone knows how to measure how large the initial meteor download will be for the first page. and some tips to minimize that size.
for example, i know there are some stock images that i can remove from my code but what i'd like to see is how much of an impact that is making (if any), and to look for additional optimizations to shrink that initial download size.
also, if there are other gotchas to be aware of in this case, i'd love to hear those as well.
In Chrome open your site then open the inspector and go to the Network tab and hit shift-cmd-R. This will completely reload the page and measure the network traffic. At the bottom of the chart you'll get a summary of network requests and bytes transferred such as:
33 requests | 31.4KB tranferred | etc...
I have an app that opens a stagewebview window on one of it's pages to display a few specifics websites. I'm in the process of performance optimizing it and I've seemed to hit a snag with the stagewebview pages.
On all of the other pages, after a few seconds of idling the memory/cpu usage drops back down to near starting levels, but if I open the stagewebview window it appears to permanently increase the memory/cpu usage by upwards of 30-40 MB, and garbage collection doesn't seem to be able to bring it back down.
This is what I'm using to clean it up:
myWebView.viewPort=null;
myWebView.dispose();
myWebView=null;
There are no event listeners associated with it. Does anyone know if this is an inherent problem with stagewebview, or am I just doing something wrong?
We faced the Same issue with the mx:Html desktop component, the main reason for this that the dom tree is built and added to your app which increase the memory, we used the following trick (it helps alot but not remove all added memory):
myWebView.loadString("");//and for desktop myHtml.loadHtml("");
this way you clean the old dom tree and create an empty one with minimum resources, i believe they should add a new function for clean up, until then we can use this workaround, hope this help :).
I have a requirement for tablet(Android) and ipad. For this am coding using sencha touch 2 wherein am not getting good performance after deploying on device using phonegap build.
For instance-
1. If i tap on select field it takes some 5 seconds to display popup.
2. Also am creating side panel includes list, on tap of each list item am setting a separate view on detail panel. Here also its taking 5 seconds to set that view in detail panel(On samsung galaxy tablet its worst case while painting the screen).
Is there any way to increase the performance on tablet?? Please help me out in solving this performance issues.
Thanks.
If you are worried about slow response to click events, you should look at what people at yelp did in their mobile website : http://engineeringblog.yelp.com/2013/01/mission-beyond-the-mobile-browser.html
Let me know if this helps
I have a panorama application and I have successfully created secondary live tile with URI pointing to the desired xaml.cs. Now the xaml part which is separate from mainpage.xaml is of no use to me so what happens is when user goes to the secondary live tile, code from desired.xaml.cs is seen by the user. But when he presses the back button, he goes to an empty page and then goes to homepage and I am aware it is not possible to jump directly to home screen. So how do I solve this issue? If you are wondering how this works - try network dashboard for Windows phone. Quite similar.
Can't reproduce. When you are navigated from a Live Tile, and presses back, you'll exit the application, since there are no other pages in the navigation stack.
The Network Dashboard works the same way.
If you somehow managed to have other pages in your navigation-stack , consider removing them using NavigationService.RemoveBackEntry
I'm just learning about how to navigate between pages and tombstoning. I'm wondering if anyone can point me to some good examples that not only show me the basics of how to use Navigation properly but also good examples of more complicated and advanced navigation issues?
Some questions I have revolve around memory leaks when navigating to other pages and navigating back?
Is there a close page call, once the page has done its job (I don't want an instance of it hanging around after I'm done with it)?
Another question is how to I maintain state if the app gets tombstoned (still trying to wrap my head around that term).
Thanks!
There's no close page call, the OS automatically closes pages when they're backed out and releases used memory (so there should be no leaks here).
Some resources here that cover tombstoning and advanced navigation concepts.
Understanding the Windows Phone Application Execution Model, Tombstoning, Launcher and Choosers, and Few More Things That Are on the Way – Part 1, Part 2, Part 3
Introducing the concept of “Places” - Peter Torr's Blog
Redirecting an initial navigation - Peter Torr's Blog
I like thinking about WP7 navigation like a simple browser that only have back button. The Naviation model is based on stack pattern (Last In First Out), need to get through all to get back to first page. This is not what PC user are used to but in mobile world is one of the best solution.
You have to stick to this model and never ever do "go to home page" button - your app will not pass the certification for sure(there are some workaround with excetions but I wouldnt recommend that).
A lot of pages can get the user pissed that's why a good idea is to have 3 to 5 pages max. For instance, first page user picks what he is going to do, next page is login page and then for more complex interface use panorama and pivot control.
To the simple browser model add cookies. When your browser load a page it sets a cookie with some information, next you close the browser and when you go back to the page it can get the previous state from that cookie. Tombstoning is very simailar. - link. Some more info about tombstoning
Some questions I have revolve around memory leaks when navigating to other pages and navigating back?
What do you mean by memory leaks? you are working in managed framework.
Is there a close page call, once the page has done its job (I don't want an instance of it hanging around after I'm done with it)?
you do not have to do this. Page is destroyed everytime you go to the next page unless a thread is still working there.
Another question is how to I maintain state if the app gets tombstoned (still trying to wrap my head around that term).
Basically it's up to develepor to manage this. It is not mandatory but gives a nice user experience.
Another question is how to I maintain state if the app gets tombstoned (still trying to wrap my head around that term).
Use Isolated Storage.
You can have a look into Columbus MVC framework for WP7 source code (http://columbus.codeplex.com/) that I have published recently. Columbus addresses both Navigation and Tombstoning (provides strongly typed navigation with history and View Models that can survive tombstoning).