XWalkView – Cleanup After Use
Ok, earlier today while I was working with XWalkView, there was an odd behaviour.
The scenario was like this,
- A Fragment adds XWalkView dynamically to the activity to display a specific content.
- Another fragment (with another XWalkView) replaces current fragment for some other functionality.
- Heap gets bigger every time XWalkView was added dynamically (or Switched between the fragments) and does not cleans up or release memory even after fragment get destroyed.
So, the solution to the problem is similar to the webview case in which webview refuses to clean up after itself (webview.destory() on onStop fixes it).
All it took was to call,
1 |
mXWalkView.onDestroy(); |
Manually during fragment disposal, this will clean up the XWalkView and release em for better garbage collection.
Leave a Reply