Replies: 2 comments 1 reply
-
On Thu, May 16, 2024 at 05:24:49AM -0700, user706 wrote:
What happens if I repeatedly do the following sequentially (say thousands of
times per minute):
• start an executable that runs curl_global_init(CURL_GLOBAL_ALL);
and then immediately exits without (!) calling curl_global_cleanup().
??
Will I somehow have less and less memory? Or any other problem?
Or will everything be clean, as if curl_global_cleanup() would have been called
before exiting?
Once a process exits, your operating system will free up all the nonpersistent
resources used by that process, so there won't be anything left once it's done.
Theoretically, some libcurl dependency could leave things like lock files lying
around that wouldn't be cleaned up, but I'm not aware of anything like that
currently being an issue. Also, leak checking systems like valgrind or
LeakSanitizer will raise warnings on exit, but you probably aren't planning on
using those.
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
bagder
-
If you're concerned about cleaning up everything properly in all cases, follow
the documentation and call curl_global_cleanup() before exit. But if your
testing reveals that the OS is doing a fine job of cleaning up on its own, you
always have the freedom to ignore the documentation.
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
is
curl_global_cleanup()
needed if I'm exiting the binary (executable)?In other words:
What happens if I repeatedly do the following sequentially (say thousands of times per minute):
curl_global_init(CURL_GLOBAL_ALL);
and then immediately exits without (!) calling
curl_global_cleanup()
.??
Will I somehow have less and less memory? Or any other problem?
Or will everything be clean, as if
curl_global_cleanup()
would have been called before exiting?Background: If it is really needed, then I have to write signal handlers, such that I ensure that
curl_global_cleanup()
is still called when terminating an application/service viasystemctl stop myapplication
. Is that really needed? Any pointers? Thanks.Thanks.
PS: Will things be somehow different, if I start such an application thousands of times per minute.... concurrently, instead of sequentially?
Beta Was this translation helpful? Give feedback.
All reactions