exec *()后内存使用情况会怎样? [英] What happens with memory usage after exec*()

查看:66
本文介绍了exec *()后内存使用情况会怎样?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C父程序执行一些处理并分配内存,然后调用execvp().所有已分配但未释放的内存将如何处理?它会自动释放还是留为垃圾?

C parent program does some processing and allocates memory, then calls execvp(). What will happen with all the allocated but not freed memory? Is it automatically freed or stays as a garbage?

推荐答案

exec *()完全用新程序替换了旧进程的内存.这包括所有分配的内存,因此不会留下任何垃圾.但请注意,文件描述符等其他资源不会自动释放或关闭.

exec*() replaced the memory of the old process completely with the new program. This includes all allocated memory, so there is no garbage staying behind. But note that other resources like file descriptors are not automatically freed or closed.

这篇关于exec *()后内存使用情况会怎样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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