FREE(3P)
π FREE(3P) β bestie edition π
okay so you're looking at FREE(3P) from the POSIX Programmer's Manual and honestly? iconic. this is the page about giving memory back. the moment where you say "ty for your service, queen, you may rest now" π«Ά
β¨ PROLOG β¨
so like, real talk first: this manual page is part of the POSIX Programmer's Manual. the Linux implementation of this interface may differ β so if you're on Linux, go check the corresponding Linux manual page for the actual tea on Linux behavior. orrr it might not even be implemented on Linux at all. no cap. π
πΈ NAME πΈ
free β free allocated memory
like. she frees. that's her whole job. π
π SYNOPSIS π
#include <stdlib.h>
void free(void *ptr);
one function, one argument, zero return value. minimalism is the vibe. β¨
π¦ DESCRIPTION π¦
okay so the functionality on this reference page is aligned with the ISO C standard. any conflict between the requirements described here and the ISO C standard is unintentional β this volume of POSIX.1β2017 defers to the ISO C standard. so if they ever beef, ISO C wins. periodt. π
the free() function shall cause the space pointed to by ptr to be deallocated β that is, made available for further allocation. think of it like clearing your camera roll so you have storage again. π§Ή
if ptr is a null pointer, no action shall occur. nothing happens. she's chill. π
otherwise β and this is the part where you need to PAY ATTENTION bestie β if the argument does not match a pointer earlier returned by a function in POSIX.1β2008 that allocates memory as if by malloc(), or if the space has been deallocated by a call to free() or realloc(), the behavior is undefined. π
β οΈ and any use of a pointer that refers to freed space results in undefined behavior. that's a use-after-free. that's the villain origin story. do not do it. π«
π RETURN VALUE π
the free() function shall not return a value.
she gives you nothing back. not even a vibe. she just takes the pointer and moves on. π
π ERRORS π
no errors are defined.
zero. none. she doesn't have bad days. (but also, the next sections are informative, so keep reading, bestie.)
π EXAMPLES π
none.
yeah. the examples section is empty. it's giving minimal effort but honestly? the function is like four words long. iykyk. π
π§ APPLICATION USAGE π§
there is now no requirement for the implementation to support the inclusion of <malloc.h>.
so like, that old header? not required anymore. glow-up achieved. β¨
β RATIONALE β
none.
πΈ FUTURE DIRECTIONS πΈ
none.
π SEE ALSO π
calloc()malloc()posix_memalign()realloc()
and the Base Definitions volume of POSIX.1β2017, <stdlib.h>
like the whole friend group. they all show up together. π«Ά
π COPYRIGHT π
portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group.
in the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. (so the original is the main character, basically. π) the original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. to report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
and that's the whole page, bestie!! π courtesy of IEEE/The Open Group, dated 2017, filed under FREE(3P). go free your memory responsibly and never touch a pointer after you've freed it, ok?? mwah. ππβ¨
π¦ where this page comes from
- alpine 3.22: man-pages-posix 2017a-r0 Β· custom
- alpine 3.23: man-pages-posix 2017a-r0 Β· custom
- alpine 3.24: man-pages-posix 2017a-r0 Β· custom
- arch rolling: man-pages 6.19-1
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages-posix 2017a
- opensuse-leap 16.0: man-pages-posix 2017a-160000.4.1 Β· SUSE-IEEE
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms