java-以编程方式清除缓存的后台进程
作者:互联网
我已经开发了一个简单的应用程序,可以并排加载四个移动Web视图.
全新安装后,应用会在0.5秒内完全打开并加载这些页面.
但是,如果我最小化此应用程序,由于某种原因其“缓存的后台进程”超过200mbs!有时250 …似乎完全不必要,因为该应用程序在全新安装时会快速加载闪电
当应用程序最小化(onbackpressed等)时,如何清除此缓存
解决方法:
您不必担心缓存的内存,因为系统会在需要时回收它.
但是,如果您仍然想对此进行操作,则可以在onStop()方法中调用finish().
也由CommonsWare在这个主题上为this is a great answer.
“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
标签:caching,background-process,java,android 来源: https://codeday.me/bug/20191119/2037690.html