webbrowser control and memory problems - memory-management

My app is using roughly 300mb. I checked all objects i created with new and wrote a using around it if it had a dispose interface. Now with the web browser control i visit rougly 450 pages all which have ads on them and many use ajax request so for sure more then 1k request.
Why is the app taking that much memory? i did notice i can click the page and hit back to visit a previous page but AFAIK IE wouldnt use up that many MBs after visiting that many pages (i dont want to hit 450 unique pages by hand to check). So why do i have these memory issues?

Which IE version are you using? The problem you describe is typical to IE5 and IE6 to a lesser degree.
I remember the days when we had to recycle an IE5 WebBrowser object because of memory leaks.
I'm not sure, but I believe the situation should be better with current generation IE.

Related

Meteor: measure and minimize initial page download size (and time)

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...

Safari and it's greedy greedy cache

Now this has come up a fair bit on here so I guess I'm looking for an explanation rather than a fix (though that would be ace), but Safari's back / forwards cache is horrifically greedy.
I've got an issue where a form submits, but loads an interstitial modal window before moving on to the form action page. On Safari the cache is so strong that the back button has the modal open still which is making my soul very sad.
I'm hacking around it by dismissing the modal and then submitting the form. On back the browser has a half closed modal (it's Bootstrap so it fades) which then just carries on dismissing.
Now I know about onunload="" but refreshing the page just seems crazy. The cache is a good thing and something you want, specially on mobiles.
I guess my question is:
Why is it so much more intense than say Chrome and is there anyway of forcing the browser to cache a state instead of just the last state?
Thanks
Hah, greedy is an understatement! Honestly though, 99% of the time, the caching design behind Safari is the ideal way to handle page transitions on a mobile device.
When you go from Page A to Page B, and then back to Page A, you don't want to burden the device (bandwidth, battery life) with fetching resources and assets, when you could just "paused" the state between interactions, and then "continue" it when you navigate back.
That's effectively what Safari Mobile does. They use a concept of Page Cache, which keeps the entire page live in memory, when you navigate from one to another. This reduces the need to fetch those resources, and allows for a snappy interaction when clicking back.
That's great and all...but it does lead to problems (such as the one you brought up) - Specifically, how do you distinguish between a page that was suspended and one that should have been destroyed?
Thankfully, WebKit provides a pageshow and pagehide event that tap into Page Cache. In addition to firing when the page shows or hides (similar to onunload), it has the nifty ability to indicate whether a page was persisted - or placed into the Page Cache.
While it's not a perfect solution, you could check the pageshow event for persistence, and then handle the modal more directly (since you know it was cached) like immediately hiding it.
If you haven't already, take a look at these two links here:
https://www.webkit.org/blog/427/webkit-page-cache-i-the-basics/
https://www.webkit.org/blog/516/webkit-page-cache-ii-the-unload-event/
They do a great job explaining the Page Cache and include code samples of the pageshow and pagehide event I referenced earlier.
Hope this helps!

No images are loading in Google Chrome - works fine in Firefox/IE

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.

Strange website loading redirect issue in IE9

I run and manage the website http://onedirection.net, and we've spent a lot of time recently trying to improve the loading speed of the site. There's a lot of content on the site which requires load time, but everything else is going smoothly.
In Chrome, we're very happy with the load speed, but things don't seem as good in IE9. In fact when we load the homepage up, it seems to pause for a while, but worse still when I click and hold the Back button, I can see about 6-7 redirects from the initial page load!
What is causing this? There are no redirects on the site, but it looks like the social media links and a couple of adverts are causing strange problems.
I've never seen this before, so I'm a bit stumped!
Also, the chat bar at the bottom of the site doesn't load properly on the homepage, but does on other pages.
Can anyone shed any light into what is causing these issues, and better still how to solve it?
Thanks,
Chris.
To be honest performance in Chrome isn't that great - from my home connection the page takes 11 seconds to load in Chrome.
Here's a waterfall for the home page in IE9 from a server in Dublin - http://www.webpagetest.org/result/120901_NC_f64ed067693fda62238e67cce432f964/1/details/
The waterfall is pretty horrible to be honest - too many requests, too many domains, no prioritisation of content, javascript in the head loading in a blocking manner
I'd need to look in more depth but essentially due to the number of third party components you've lost control of your page load.

MemoryLeak in Windows Phone 7.5 / Silverlight app

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.

Resources