当程序退出时,泄漏的内存是否释放? [英] Is leaked memory freed up when the program exits?
问题描述
是的,内存泄漏只是一个进程不再引用,因此不再可以释放的内存。
更新
在绝大多数情况下,操作系统将释放内存,就像Windows,Linux,Solaris等普通风格的情况一样。然而,重要的是要注意,专用环境(例如各种实时操作系统),程序终止时内存可能不会被释放。
If I programmed without knowing it a memory leak, and the application terminates, is the memory of the memory leak freed?
Yes, a "memory leak" is simply memory that a process no longer has a reference to, and thus can no longer free. The OS still keeps track of all the memory allocated to a process, and will free it when that process terminates.
Update
In the vast majority of cases the OS will free the memory - as is the case with normal "flavors" of Windows, Linux, Solaris, etc. However it is important to note that in specialized environments such as various Real-Time Operating Systems the memory may not be freed when the program is terminated.
这篇关于当程序退出时,泄漏的内存是否释放?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!