curl_global_cleanup.3 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. .\" generated by cd2nroff 0.1 from curl_global_cleanup.md
  2. .TH curl_global_cleanup 3 "2025-01-17" libcurl
  3. .SH NAME
  4. curl_global_cleanup \- global libcurl cleanup
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. void curl_global_cleanup(void);
  9. .fi
  10. .SH DESCRIPTION
  11. This function releases resources acquired by \fIcurl_global_init(3)\fP.
  12. You should call \fIcurl_global_cleanup(3)\fP once for each call you make to
  13. \fIcurl_global_init(3)\fP, after you are done using libcurl.
  14. This function is thread\-safe since libcurl 7.84.0 if
  15. \fIcurl_version_info(3)\fP has the CURL_VERSION_THREADSAFE feature bit set
  16. (most platforms).
  17. If this is not thread\-safe, you must not call this function when any other
  18. thread in the program (i.e. a thread sharing the same memory) is running.
  19. This does not just mean no other thread that is using libcurl. Because
  20. \fIcurl_global_cleanup(3)\fP calls functions of other libraries that are
  21. similarly thread unsafe, it could conflict with any other thread that uses
  22. these other libraries.
  23. See the description in \fIlibcurl(3)\fP of global environment requirements for
  24. details of how to use this function.
  25. .SH CAUTION
  26. \fIcurl_global_cleanup(3)\fP does not block waiting for any libcurl\-created
  27. threads to terminate (such as threads used for name resolving). If a module
  28. containing libcurl is dynamically unloaded while libcurl\-created threads are
  29. still running then your program may crash or other corruption may occur. We
  30. recommend you do not run libcurl from any module that may be unloaded
  31. dynamically. This behavior may be addressed in the future.
  32. libcurl may not be able to fully clean up after multi\-threaded OpenSSL
  33. depending on how OpenSSL was built and loaded as a library. It is possible in
  34. some rare circumstances a memory leak could occur unless you implement your own
  35. OpenSSL thread cleanup. Refer to \fIlibcurl\-thread(3)\fP.
  36. .SH PROTOCOLS
  37. This functionality affects all supported protocols
  38. .SH EXAMPLE
  39. .nf
  40. int main(void)
  41. {
  42. curl_global_init(CURL_GLOBAL_DEFAULT);
  43. /* use libcurl, then before exiting... */
  44. curl_global_cleanup();
  45. }
  46. .fi
  47. .SH AVAILABILITY
  48. Added in curl 7.8
  49. .SH RETURN VALUE
  50. None
  51. .SH SEE ALSO
  52. .BR curl_global_init (3),
  53. .BR libcurl (3),
  54. .BR libcurl-thread (3)