gpt4 book ai didi

c++ - curl_easy_setopt(curl, CURLOPT_POSTFIELDS, msg_out);重复内存?

转载 作者:太空宇宙 更新时间:2023-11-04 07:08:25 27 4
gpt4 key购买 nike

我用了很多次

curl_easy_setopt(curl, CURLOPT_POSTFIELDS, msg_out); 

在我使用 curl_easy_cleanup() 函数清理之前的代码中。

CURL 是否在其环境中制作了 msg_out 的内存拷贝(动态内存)?

最佳答案

不,它默认不复制,这在 CURLOPT_POSTFIELDS documentation 中有说明:

The data pointed to is NOT copied by the library: as a consequence, it must be preserved by the calling application until the associated transfer finishes. This behaviour can be changed (so libcurl does copy the data) by setting the CURLOPT_COPYPOSTFIELDS option.

关于c++ - curl_easy_setopt(curl, CURLOPT_POSTFIELDS, msg_out);重复内存?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30332633/

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