简体   繁体   English

堆上未释放的内存会怎样?

[英]What happens to unreleased memory on the heap?

If we miss to free any memory allocated on the heap, is that memory going to be unavailable for ever? 如果我们错过了释放堆上分配的任何内存的机会,那么该内存将永远不可用吗? As it is the responsibility of the developer to free it? 作为开发者的责任来释放它吗? If not, at which point the freeing of memory will happen? 如果没有,那将在何时释放内存?

During program run yes that memory would be unavailable to you. 是的,在程序运行期间,您将无法使用内存。

All memory would be freed up when your application exits. 应用程序退出时,所有内存将被释放。

Memory that is allocated by your app's process will be tied up until the process terminates. 应用程序的进程分配的内存将被占用,直到该进程终止。 Android terminates SDK apps' processes from time to time, to free up system RAM for other processes. Android会不时终止SDK应用程序的进程 ,以释放系统RAM供其他进程使用。 This will only occur while your process is in the background (eg, user presses HOME). 这只会在您的进程处于后台(例如,用户按下HOME)时发生。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM