gpt4 book ai didi

optimization - 释放已分配的内存

转载 作者:行者123 更新时间:2023-12-03 05:14:39 26 4
gpt4 key购买 nike

在当前函数退出之前,是否可以显式释放 C 的 alloca() 分配的内存?如果是这样,怎么办?

最佳答案

来自http://www.gnu.org/software/libc/manual/html_mono/libc.html#Variable-Size-Automatic :

Allocating a block with alloca is an explicit action; you can allocate as many blocks as you wish, and compute the size at run time. But all the blocks are freed when you exit the function that alloca was called from, just as if they were automatic variables declared in that function. There is no way to free the space explicitly.

关于optimization - 释放已分配的内存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/283024/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com