I've developed a simple application that loads four mobile webviews side by side. On a fresh install the app fully opens and loads these pages in under 0.5 seconds. However if i minimize this app, for some reason its "cached background process" is over 200mbs! sometimes 250... Seems completely unnecessary as the app loads lightning fast on a fresh install
How can I clear this cache when the app is minimized (onbackpressed etc)
You need not to worry about cached memory as system will reclaim it when required.
however if still you want to do something about it you can call finish()
in your onStop()
method.
also this is a great answer on this topic by CommonsWare.
"cached background processes" usually refers to processes that do not have a foreground activity and do not have a running service. These processes are kept in memory simply because we have enough memory to do so, and therefore, as you note, the user can switch back to these processes quickly. As Android starts to need more system RAM for yet other processes, the "cached background processes" tend to be the processes that get terminated to free up system RAM