当进程被杀死时如何从内存中清除进程
如何在进程被杀死时从内存中清除进程,我不在乎进程是空的还是什么都不做。只是想从内存中清除它。
或者
1M 文件读取一次后,读取两次时将从内存/缓存中读取。 问题是一次读取后可以从内存或缓存中清除吗?
谢谢
how to clear process from memory when it is killed, i do not care the process is empty or do nothing. just want to clear it from memory.
OR
After read a 1M file once, it will be read from memory/cache when read it twice.
the question is can it be clear from memory or cache after once read?
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最好的答案是:你不“清除它”:你让 android 处理它们。如果(当)需要内存时,任何进程都会被终止。关于缓存,垃圾收集器将处理它。再说一遍,您无需做任何事情(也许除了确保您没有在某处留下对其的实时引用)。
我引用以下部分 Dianne Hackborn 的在 Android 博客中发布:
The best answer is: you don't "clear it": you let android handle them. Any process will be killed if (when) there is a memory need. Regarding caches, the garbage collector will take care of it. Again, no need to do anything on your side (except, maybe, making sure you did not leave live references to it somewhere).
I am quoting below part of Dianne Hackborn's post in the android blog:
如果您正在寻找终止该进程,这可能会有所帮助,
If you are looking for killing the process, this might help,