Hi,
Restarting one WebView should be sufficient most of the time and it may be good enough for practical purpose. The reason that we say that it can not be guaranteed is because of the GC's non-deterministic nature by design and we do not have control over that. In practice, even though GC is non-deterministic, the objects that lives in the GC heap are primarily DOM tree related objects and JavaScript object. Both will be completely destroyed when the WebView is destroyed. This hopefully will trigger GC pretty soon to reclaim the memory.
Even if GC does not kick in right away, destroying the WebView may be sufficient enough if there are no other WebView in the same Engine that loads pages from the same domain. By default, render process (which houses the DOM tree and JavaScript engine) are isolated by domains. So if you have two WebViews, one loading page from
www.site1.com and the other from
www.site2.com, then each WebView will have their own rendering process and destroying the WebView will destroy the corresponding render process thus freeing up everything. This provides a process level guarantee since terminating the process will free up everything.
If you must have the process level guarantee but still want to have multiple WebViews, then you can consider creating multiple Engine objects and creating only one WebView for each Engine object. Each Engine object is completely isolated --- including cookies and cache, so it may not be what you wanted.
Hope this gives you some insight and helps you making the right choice for your application. Please feel free to let us know if you still have questions.
Thanks!