1 .\" Copyright (c) 2003 Andries Brouwer (aeb@cwi.nl)
3 .\" This is free documentation; you can redistribute it and/or
4 .\" modify it under the terms of the GNU General Public License as
5 .\" published by the Free Software Foundation; either version 2 of
6 .\" the License, or (at your option) any later version.
8 .\" The GNU General Public License's references to "object code"
9 .\" and "executables" are to be interpreted as the output of any
10 .\" document formatting or typesetting system, including
11 .\" intermediate and printed output.
13 .\" This manual is distributed in the hope that it will be useful,
14 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
15 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 .\" GNU General Public License for more details.
18 .\" You should have received a copy of the GNU General Public
19 .\" License along with this manual; if not, write to the Free
20 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
23 .\" Japanese Version Copyright (c) 2004 Yuichi SATO
24 .\" all rights reserved.
25 .\" Translated Mon Jul 19 04:38:03 JST 2004
26 .\" by Yuichi SATO <ysato444@yahoo.co.jp>
28 .TH CFREE 3 2007-07-26 "" "Linux Programmer's Manual"
31 .\"O cfree \- free allocated memory
32 cfree \- ³ä¤êÅö¤Æ¤é¤ì¤¿¥á¥â¥ê¤ò²òÊü¤¹¤ë
37 .B "#include <stdlib.h>"
41 .BI "int cfree(void *" ptr );
43 .\"O /* In glibc or FreeBSD libcompat */
44 /* glibc ¤È FreeBSD libcompat ¤Ç¤Ï */
45 .BI "void cfree(void *" ptr );
47 .\"O /* In SCO OpenServer */
48 /* SCO OpenServer ¤Ç¤Ï */
49 .BI "void cfree(char *" ptr ", unsigned " num ", unsigned " size );
51 .\"O /* In Solaris watchmalloc.so.1 */
52 /* Solaris watchmalloc.so.1 ¤Ç¤Ï */
53 .BI "void cfree(void *" ptr ", size_t " nelem ", size_t " elsize );
57 .\"O Feature Test Macro Requirements for glibc (see
58 .\"O .BR feature_test_macros (7)):
59 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
60 .RB ( feature_test_macros (7)
65 _BSD_SOURCE || _SVID_SOURCE
68 .\"O This function should never be used.
72 ¤³¤Î´Ø¿ô¤Ï·è¤·¤Æ»ÈÍѤ¹¤Ù¤¤Ç¤Ï¤Ê¤¤¡£
76 .\"O .SS "1-arg cfree"
77 .SS "°ú¤¿ô¤¬ 1 ¤Ä¤Î cfree"
78 .\"O In glibc, the function
82 .\"O "added for compatibility with SunOS".
87 ¤ÎÊÌ̾¤Ç¤¢¤ê¡¢¡ÖSunOS ¤È¤Î¸ß´¹À¤Î¤¿¤á¤ËÄɲ䵤줿¡×¡£
89 .\"O Other systems have other functions with this name.
90 ¾¤Î¥·¥¹¥Æ¥à¤Ç¤Ï¡¢¤³¤Î̾Á°¤ÎÊ̤δؿô¤¬¤¢¤ë¡£
91 .\"O The declaration is sometimes in
97 ¤Ë¸ºß¤¹¤ë¾ì¹ç¤â¤¢¤ë¤·¡¢
99 ¤Ë¸ºß¤¹¤ë¾ì¹ç¤â¤¢¤ë¡£
100 .\"O .SS "3-arg cfree"
101 .SS "°ú¤¿ô¤¬ 3 ¤Ä¤Î cfree"
102 .\"O Some SCO and Solaris versions have malloc libraries with a 3-argument
104 .\"O apparently as an analog to
106 SCO ¤È Solaris ¤Î¤¤¤¯¤Ä¤«¤Î¥Ð¡¼¥¸¥ç¥ó¤Ç¤Ï¡¢
109 ¤¬´Þ¤Þ¤ì¤ë malloc ¥é¥¤¥Ö¥é¥ê¤¬¤¢¤ë¡£
114 .\"O If you need it while porting something, add
115 ²¿¤«¤ò°Ü¿¢¤¹¤ë»þ¤Ë¤³¤Î´Ø¿ô¤¬É¬Íפʾì¹ç¡¢
118 #define cfree(p, n, s) free((p))
122 ¤ò¥Õ¥¡¥¤¥ë¤ËÄɲ乤뤳¤È¡£
124 .\"O A frequently asked question is "Can I use
126 .\"O to free memory allocated with
132 ¤Ç³ä¤êÅö¤Æ¤é¤ì¤¿¥á¥â¥ê¤ò²òÊü¤¹¤ë¤Î¤Ë
134 ¤ò»È¤¦¤³¤È¤¬¤Ç¤¤ë¤«¡¢
137 ¤ò»È¤¦É¬Íפ¬¤¢¤ë¤«¡×¤È¤¤¤¦¤â¤Î¤Ç¤¢¤ë¡£
142 .\"O An SCO manual writes: "The cfree routine is provided for compliance
143 .\"O to the iBCSe2 standard and simply calls free.
144 .\"O The num and size
145 .\"O arguments to cfree are not used."
146 SCO ¤Î¥Þ¥Ë¥å¥¢¥ë¤Ë¤Ï°Ê²¼¤Î¤è¤¦¤Ëµ½Ò¤µ¤ì¤Æ¤¤¤ë:
147 ¡Öcfree ¥ë¡¼¥Á¥ó¤Ï iBCSe2 µ¬³Ê¤Ë½¾¤¦¤¿¤á¤ËÄ󶡤µ¤ì¤Æ¤ª¤ê¡¢
148 ñ¤Ë free ¤ò¸Æ¤ó¤Ç¤¤¤ë¤À¤±¤Ç¤¢¤ë¡£
149 cfree ¤Î num ¤È size °ú¤¿ô¤Ï»ÈÍѤµ¤ì¤Ê¤¤¡£¡×
150 .\"O .SH "RETURN VALUE"
152 .\"O The SunOS version of
154 .\"O (which is a synonym for
156 .\"O returns 1 on success and 0 on failure.
160 ¤ÎÊÌ̾) ¤Ï¡¢À®¸ù¤·¤¿¾ì¹ç¤Ë 1 ¤òÊÖ¤·¡¢¼ºÇÔ¤·¤¿¾ì¹ç¤Ë 0 ¤òÊÖ¤¹¡£
161 .\"O In case of error,
167 .\"O was not a pointer to a block previously allocated by
168 .\"O one of the routines in the
179 ·Ï¤Î¥ë¡¼¥Á¥ó¤Î 1 ¤Ä¤Ç°ÊÁ°¤Ë³ä¤êÅö¤Æ¤é¤ì¤¿
180 ¥Ö¥í¥Ã¥¯¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤Ê¤¤¡£
181 .\"O .SH "CONFORMING TO"
183 .\"O The 3-argument version of
185 .\"O as used by SCO conforms to the iBCSe2 standard:
186 .\"O Intel386 Binary Compatibility Specification, Edition 2.
187 SCO ¤ÇÍѤ¤¤é¤ì¤Æ¤¤¤ë°ú¤¿ô¤¬ 3 ¤Ä¤Î
190 Intel386 Binary Compatibility Specification, Edition 2
191 (Intel386 ¥Ð¥¤¥Ê¥ê¸ß´¹»ÅÍÍ¡¢Âè 2 ÈÇ) ¤Ë½àµò¤¹¤ë¡£