在C中调用APORT:它会释放堆内存吗?

发布于 2025-01-21 23:42:07 字数 110 浏览 4 评论 0原文

在C中调用Abort()将导致该过程的异常终止。我可以通过在线资源找到它不会关闭打开文件,可能不会删除临时文件,也可能不会冲洗流缓冲区。动态分配的内存(通过malloc()函数分配)怎么样?他们被收回了吗?

Calling abort() in C will cause abnormal termination of the process. I could find through online resources that it does not close open files, may not delete temporary files and may not flush stream buffer. How about dynamically allocated memory (allocated through malloc() function)? Are they reclaimed?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

酒中人 2025-01-28 23:42:07

当程序终止(在正常的,托管C的实现中)时,程序所使用的内存将释放。它是通过abort()还是通过普通出口终止的都没关系。

如果您处于一个模糊(和敌对的)嵌入式系统中,则可能会发现规则不同,但是(AFAIK)即使在独立实现方面也是不寻常的,因为在程序退出时,不会发布内存,而不论如何如何它退出。

When a program terminates (in a normal, hosted implementation of C), the memory the program used is freed. It doesn't matter whether it terminates via abort() or via a normal exit.

If you're on an obscure (and hostile) embedded system, you might find the rules are different, but it is (AFAIK) unusual, even in freestanding implementations, for the memory not to be released when the program exits, regardless of how it exits.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文