如何以编程方式清除Android中的非活动内存?
问题描述:
如何释放Android中的非活动内存?我见过一些声称以编程方式释放RAM的应用程序.研究它们之后,我发现它们释放了该设备的非活动内存.有没有API可以做到这一点?
How to free inactive memory in Android? I have seen some applications that claim to free RAM programmatically. After having studied them I found they free inactive memory of the device. Are there any APIs to do this?
答
选中此主要代码:
public void freeMemory(){
System.runFinalization();
Runtime.getRuntime().gc();
System.gc();
}