2 .\" Copyright (c) 2003 Andries Brouwer (aeb@cwi.nl)
4 .\" SPDX-License-Identifier: GPL-2.0-or-later
6 .TH cfree 3 (date) "Linux man-pages (unreleased)"
8 cfree \- free allocated memory
11 .RI ( libc ", " \-lc )
15 .B "#include <stdlib.h>"
18 .BI "int cfree(void *" ptr );
20 /* In glibc or FreeBSD libcompat */
21 .BI "void cfree(void *" ptr );
23 /* In SCO OpenServer */
24 .BI "void cfree(char " ptr [. size " * ." num "], unsigned int " num ", \
25 unsigned int " size );
27 /* In Solaris watchmalloc.so.1 */
28 .BI "void cfree(void " ptr [. elsize " * ." nelem "], size_t " nelem ", \
33 Feature Test Macro Requirements for glibc (see
34 .BR feature_test_macros (7)):
41 glibc 2.19 and earlier:
42 _BSD_SOURCE || _SVID_SOURCE
45 This function should never be used.
49 Starting with glibc 2.26, it has been removed from glibc.
51 In glibc, the function
55 "added for compatibility with SunOS".
57 Other systems have other functions with this name.
58 The declaration is sometimes in
63 Some SCO and Solaris versions have malloc libraries with a 3-argument
65 apparently as an analog to
68 If you need it while porting something, add
72 #define cfree(p, n, s) free((p))
78 A frequently asked question is "Can I use
80 to free memory allocated with
87 An SCO manual writes: "The cfree routine is provided for compliance
88 to the iBCSe2 standard and simply calls free.
90 arguments to cfree are not used."
94 (which is a synonym for
96 returns 1 on success and 0 on failure.
103 was not a pointer to a block previously allocated by
104 one of the routines in the
111 .\" commit 025b33ae84bb8f15b2748a1d8605dca453fce112
114 For an explanation of the terms used in this section, see
122 Interface Attribute Value
125 T} Thread safety MT-Safe /* In glibc */
131 The 3-argument version of
133 as used by SCO conforms to the iBCSe2 standard:
134 Intel386 Binary Compatibility Specification, Edition 2.