I have a graphic-intensive iPad app that features a UIWebView. Using the simulator (iOS 4.2.1), I can see Real Mem increase quite a lot as I browse. The more I browse, the more RAM it uses. When I close the UIWebView and release it, some of the memory it used is freed, but not all of it. This is annoying. Okay, so maybe it's because it isn't deallocated right away. Fine. But then I would expect the system to do some cleanup when there's a memory warning. However, if I browse around, then close the UIWebView (and release it), then trigger a memory warning in the simulator, Real Mem does not change! WTF?
So why is this? Why isn't UIWebView better at releasing memory back to the system? And why doesn't it appear to respond to memory warnings? Am I missing something?
Adding as an answer since it seemed to have helped:
Activity Monitor is useless for debugging purposes. Use Allocations Instrument. Note that the simulator can behave significantly differently than an app on the device.
Happy to have helped. I often find that turning on "Only track live allocations" is quite helpful for watching the ongoing working set of my applications. Live/dead tracking is useful, too.
Oh, and heapshot analysis (article on my weblog) can be extremely effective in tracking down memory leaks.
Leaks? Never use it. Heapshot analysis entirely replaces it for me. Your mileage may vary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With