{"id":6860,"date":"2022-12-20T19:33:44","date_gmt":"2022-12-20T22:33:44","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/cfree-man3\/"},"modified":"2022-12-20T19:33:44","modified_gmt":"2022-12-20T22:33:44","slug":"cfree-man3","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/cfree-man3\/","title":{"rendered":"CFREE (man3)"},"content":{"rendered":"<h1 align=\"center\">CFREE<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#RETURN VALUE\">RETURN VALUE<\/a><br \/> <a href=\"#VERSIONS\">VERSIONS<\/a><br \/> <a href=\"#ATTRIBUTES\">ATTRIBUTES<\/a><br \/> <a href=\"#CONFORMING TO\">CONFORMING TO<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#COLOPHON\">COLOPHON<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">cfree \u2212 free allocated memory<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>#include <stdlib.h><\/b><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">\/* In SunOS 4 bodies\/ usr\/ <b><br \/> int cfree(void *<\/b><i>ptr<\/i><b>);<\/b><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">\/* In glibc or FreeBSD libcompat bodies\/ usr\/ <b><br \/> void cfree(void *<\/b><i>ptr<\/i><b>);<\/b><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">\/* In SCO OpenServer bodies\/ usr\/ <b><br \/> void cfree(char *<\/b><i>ptr<\/i><b>, unsigned<\/b> <i>num<\/i><b>, unsigned<\/b> <i>size<\/i><b>);<\/b><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">\/* In Solaris watchmalloc.so.1 bodies\/ usr\/ <b><br \/> void cfree(void *<\/b><i>ptr<\/i><b>, size_t<\/b> <i>nelem<\/i><b>, size_t<\/b> <i>elsize<\/i><b>);<\/b><\/p>\n<p style=\"margin-left:5%; margin-top: 1em\">Feature Test Macro Requirements for glibc (see <b>feature_test_macros<\/b>(7)):<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>cfree<\/b>(): <br \/> Since glibc 2.19: <br \/> _DEFAULT_SOURCE <br \/> Glibc 2.19 and earlier: <br \/> _BSD_SOURCE || _SVID_SOURCE<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This function should never be used. Use <b>free<\/b>(3) instead. Starting with version 2.26, it has been removed from glibc.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>1-arg cfree<\/b> <br \/> In glibc, the function <b>cfree<\/b>() is a synonym for <b>free<\/b>(3), &#8220;added for compatibility with SunOS&#8221;.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Other systems have other functions with this name. The declaration is sometimes in <i><stdlib.h><\/i> and sometimes in <i><malloc.h><\/i>.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>3-arg cfree<\/b> <br \/> Some SCO and Solaris versions have malloc libraries with a 3-argument <b>cfree<\/b>(), apparently as an analog to <b>calloc<\/b>(3).<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">If you need it while porting something, add<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">#define cfree(p, n, s) free((p))<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">to your file.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">A frequently asked question is &#8220;Can I use <b>free<\/b>(3) to free memory allocated with <b>calloc<\/b>(3), or do I need <b>cfree<\/b>()?&#8221; Answer: use <b>free<\/b>(3).<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">An SCO manual writes: &#8220;The cfree routine is provided for compliance to the iBCSe2 standard and simply calls free. The num and size arguments to cfree are not used.&#8221;<\/p>\n<h2>RETURN VALUE <a name=\"RETURN VALUE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The SunOS version of <b>cfree<\/b>() (which is a synonym for <b>free<\/b>(3)) returns 1 on success and 0 on failure. In case of error, <i>errno<\/i> is set to <b>EINVAL<\/b>: the value of <i>ptr<\/i> was not a pointer to a block previously allocated by one of the routines in the <b>malloc<\/b>(3) family.<\/p>\n<h2>VERSIONS <a name=\"VERSIONS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>cfree<\/b>() function was removed from glibc in version 2.26.<\/p>\n<h2>ATTRIBUTES <a name=\"ATTRIBUTES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">For an explanation of the terms used in this section, see <b>attributes<\/b>(7).<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"7%\"> <\/td>\n<td width=\"8%\"> <\/td>\n<td width=\"8%\"><\/td>\n<td width=\"7%\"><\/td>\n<td width=\"62%\"> <\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"7%\"><\/td>\n<td width=\"8%\"> <\/td>\n<td width=\"8%\"><\/td>\n<td width=\"7%\"><\/td>\n<td width=\"62%\"> <\/td>\n<\/tr>\n<\/table>\n<p align=\"center\"><img decoding=\"async\" src=\"grohtml-1590931.png\" alt=\"Image grohtml-1590931.png\"><\/p>\n<h2>CONFORMING TO <a name=\"CONFORMING TO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The 3-argument version of <b>cfree<\/b>() as used by SCO conforms to the iBCSe2 standard: Intel386 Binary Compatibility Specification, Edition 2.<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>malloc<\/b>(3)<\/p>\n<h2>COLOPHON <a name=\"COLOPHON\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This page is part of release 5.10 of the Linux <i>man-pages<\/i> project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https:\/\/www.kernel.org\/doc\/man\u2212pages\/.<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  cfree \u2212 free allocated memory <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2536],"tags":[2538,3225,3007],"class_list":["post-6860","post","type-post","status-publish","format-standard","hentry","category-3-llamadas-de-bibliotecas","tag-2538","tag-cfree","tag-man3"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6860","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=6860"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6860\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=6860"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=6860"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=6860"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}