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 :).
Related
Our app loads extremely slowly, especially the pictures, and the developer has not been able to come up with a solution to this. The movements are slow and the buttons are slow in response (works on the 2nd or 3rd press).
The stability is terrible, for example the whole screen moves to the left by 2mm when you press a back button.
The app downloads information from the server every time it runs. We have tried changing the server, but this did not yield any results.
The current solution is to make the images smaller (compress them) to make the app run faster, but we are dubious if this will work.
Is there anybody who has had the same problems with their app?
I would be very grateful for any suggestions for how to fix this. We need it to be fast and responsive.
These are very vague, general issues. You ideally need a developer to take a look at the whole problem.
Some things they may look into would be:
Is data access asynchronous?
Are there transitions running on the
page?
Are styles being added on hover or focus?
If the app is written badly, simply chucking more resources at it probably won't solve the problem.
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...
For some reason when I use Chrome to test out my website, no images load at all, not even tiny ones like loading icons or the simple "back to top of page" arrow icon at the bottom. The browser tab just hangs on the spinning circle loading state. If I refresh it like 10 times or something then a portion of the images might load. Interestingly my Nivo-Slider images never load... there is a large empty space at where the Nivo-Slider gallery should be at the top left of my page no matter how many times I refresh.
The console is completely clean of errors if you check.
Can anyone check for me why my website is not working in Chrome? It works perfectly in Firefox/IE. I admit some images might have large file sizes but it shouldn't cause Chrome to hang for like half an hour?
I'm using latest Chrome/IE/Firefox. Windows 7 64-bit.
My website: www.symphonyofpromise.com/inspiration/en
By the way my website is a completely fictional museum/gallery project, it's not the official site for some museum!
I cannot be 100% certain on this, but judging from the Network panel, you might be loading too many MP3 files at the same time, thus maxing out the number of simultaneous requests. Chrome might use a different prioritization algorithm.
I would recommend removing some of those MP3 files and deferring loading until after the initial load.
EDIT:
Nevermind that, it appears that the MP3s load fine, but other resources are definitely blocking it. A request should never be pending this long. Poke around further in the Network panel and you'll find the problem.
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.
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).