进程结束后,动态内存是否会释放

程序结束后,动态内存没有free或delete,操作系统会回收吗?

I have a doubt about the role of the operating system in regards to a process lifetime right now. I am using Linux.

Suppose that I have an application that creates a set of objects in the heap using new. During the lifetime of the application I have no need to delete any of those objects except at the exit the application or on an exception before exiting to do the clean-up.

Suppose I don't call delete at the end of the application for all those objects, do usually the OS reclaim/free all the heap allocated to make it available again at the process exits? If the process exit because of an exception or call to return or exit, does this always occurs?

If this is true this means that if I don't call delete there won't be any impact on the OS

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值