1 .\" Copyright (c) 2003 Andries Brouwer (aeb@cwi.nl)
3 .\" %%%LICENSE_START(GPLv2+_DOC_FULL)
4 .\" This is free documentation; you can redistribute it and/or
5 .\" modify it under the terms of the GNU General Public License as
6 .\" published by the Free Software Foundation; either version 2 of
7 .\" the License, or (at your option) any later version.
9 .\" The GNU General Public License's references to "object code"
10 .\" and "executables" are to be interpreted as the output of any
11 .\" document formatting or typesetting system, including
12 .\" intermediate and printed output.
14 .\" This manual is distributed in the hope that it will be useful,
15 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
16 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 .\" GNU General Public License for more details.
19 .\" You should have received a copy of the GNU General Public
20 .\" License along with this manual; if not, see
21 .\" <http://www.gnu.org/licenses/>.
24 .TH CFREE 3 2007-07-26 "" "Linux Programmer's Manual"
26 cfree \- free allocated memory
30 .B "#include <stdlib.h>"
33 .BI "int cfree(void *" ptr );
35 /* In glibc or FreeBSD libcompat */
36 .BI "void cfree(void *" ptr );
38 /* In SCO OpenServer */
39 .BI "void cfree(char *" ptr ", unsigned " num ", unsigned " size );
41 /* In Solaris watchmalloc.so.1 */
42 .BI "void cfree(void *" ptr ", size_t " nelem ", size_t " elsize );
46 Feature Test Macro Requirements for glibc (see
47 .BR feature_test_macros (7)):
51 _BSD_SOURCE || _SVID_SOURCE
53 This function should never be used.
58 In glibc, the function
62 "added for compatibility with SunOS".
64 Other systems have other functions with this name.
65 The declaration is sometimes in
70 Some SCO and Solaris versions have malloc libraries with a 3-argument
72 apparently as an analog to
75 If you need it while porting something, add
78 #define cfree(p, n, s) free((p))
83 A frequently asked question is "Can I use
85 to free memory allocated with
92 An SCO manual writes: "The cfree routine is provided for compliance
93 to the iBCSe2 standard and simply calls free.
95 arguments to cfree are not used."
99 (which is a synonym for
101 returns 1 on success and 0 on failure.
108 was not a pointer to a block previously allocated by
109 one of the routines in the
113 The 3-argument version of
115 as used by SCO conforms to the iBCSe2 standard:
116 Intel386 Binary Compatibility Specification, Edition 2.