i\'m trying to release UIWebView object but it not free memory. is it have any reason?
Just because you've released it doesn't mean that it can be released - maybe it's being used by something else?
What is it's retain count after you have freed it?
[myWebView release];
NSLog(@"%i", [myWebView retainCount]);
If this number is not 0, someone else is retaining it as well and it can't be freed until they release it too (or it's set to be autoreleased so it will vanish at some point in the future).
Another possibility is that the memory used is in some sort of shared library that gets loaded when a web view is created - you'll probably get no control of how to unload that.
Sam
PS I'm assuming that you've also done [myWebView removeFromSuperview];
- adding yourself to a view will retain you.
There are a bunch of tricks (check original post for some others) that may help to clean as much memory as possible when releasing a UIWebView. Unfortunately, they never reach complete release of memory used. The one that usually works better for me is to empty the HTML Document of the WebView before releasing it.
// Empty the HTML document. This hack free some additional memory
[webview stringByEvaluatingJavaScriptFromString:@"document.body.innerHTML='';"];
But I never reach complete release of memory used by the web component :(
Also, if your want to clear the URLcache too, you can try to clear it with this call:
// remove all cached responses
[[NSURLCache sharedURLCache] removeAllCachedResponses];
This will clear the sharedURLCache used by the App for any URLRequest (including the ones done inside the UIWebView).
Maybe clearing the cache might help? See NSURLCache
class.