1 .\" Copyright (c) 2003 Andries Brouwer (aeb@cwi.nl)
3 .\" SPDX-License-Identifier: GPL-2.0-or-later
5 .TH CFREE 3 2021-03-22 GNU "Linux Programmer's Manual"
7 cfree \- free allocated memory
10 .RI ( libc ", " \-lc )
14 .B "#include <stdlib.h>"
17 .BI "int cfree(void *" ptr );
19 /* In glibc or FreeBSD libcompat */
20 .BI "void cfree(void *" ptr );
22 /* In SCO OpenServer */
23 .BI "void cfree(char *" ptr ", unsigned int " num ", unsigned int " size );
25 /* In Solaris watchmalloc.so.1 */
26 .BI "void cfree(void *" ptr ", size_t " nelem ", size_t " elsize );
30 Feature Test Macro Requirements for glibc (see
31 .BR feature_test_macros (7)):
38 Glibc 2.19 and earlier:
39 _BSD_SOURCE || _SVID_SOURCE
42 This function should never be used.
46 Starting with version 2.26, it has been removed from glibc.
48 In glibc, the function
52 "added for compatibility with SunOS".
54 Other systems have other functions with this name.
55 The declaration is sometimes in
60 Some SCO and Solaris versions have malloc libraries with a 3-argument
62 apparently as an analog to
65 If you need it while porting something, add
69 #define cfree(p, n, s) free((p))
75 A frequently asked question is "Can I use
77 to free memory allocated with
84 An SCO manual writes: "The cfree routine is provided for compliance
85 to the iBCSe2 standard and simply calls free.
87 arguments to cfree are not used."
91 (which is a synonym for
93 returns 1 on success and 0 on failure.
100 was not a pointer to a block previously allocated by
101 one of the routines in the
108 .\" commit 025b33ae84bb8f15b2748a1d8605dca453fce112
109 from glibc in version 2.26.
111 For an explanation of the terms used in this section, see
119 Interface Attribute Value
122 T} Thread safety MT-Safe /* In glibc */
128 The 3-argument version of
130 as used by SCO conforms to the iBCSe2 standard:
131 Intel386 Binary Compatibility Specification, Edition 2.