当程序退出时,泄漏的内存是否释放? [英] Is leaked memory freed up when the program exits?

查看:134
本文介绍了当程序退出时,泄漏的内存是否释放?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我编程了而不知道内存泄漏,应用程序终止,解决方案

是的,内存泄漏只是一个进程不再引用,因此不再可以释放的内存。



更新



在绝大多数情况下,操作系统将释放内存,就像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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆