Why doesn't UIWebView free up all the memory?

I have an iPad graphics application that has a UIWebView. Using the simulator (iOS 4.2.1), I see that Real Mem increases quite a lot when I browse. The more I browse, the more RAM it uses. When I close the UIWebView and free it, some of the used memory is freed, but not all. This is annoying. Good, so maybe because he is not released immediately. Good. But then I would expect the system to do some cleanup when there is a memory warning. However, if I browse and then close UIWebView (and release it) and then trigger a memory warning in the simulator, Real Mem will not change! WTF?

So why is that? Why is UIWebView not better at restoring memory in the system? And why does he not respond to memory warnings? Did I miss something?

+7
source share
1 answer

Adding an answer as it helped:

The activity monitor is useless for debugging. Use selection tool. Please note that the simulator may behave differently than the application on the device.

Happy to help. I often find that the inclusion of "Only track live selections" is very useful for viewing the current working set of my applications. Live and dead tracking is also helpful.

Oh, and heapshot analysis (an article on my blog) can be extremely effective for tracking memory leaks.

A leak? Never use it. The heapshot analysis completely replaces it for me. Your mileage may vary.

+6
source

All Articles