free is a function to deallocate memory obtained from malloc and other functions in C. Do not use this tag to refer to free software. Asking for software recommendation is off-topic on Stack Overflow. If you have a question about free software, you can ask here: https://softwarerecs.stackexchange.com/
free()
is the Standard C (ISO 9899:1989) function declared in <stdlib.h>
to deallocate memory allocated by a previous call to malloc
, calloc
, or realloc
. On POSIX (IEEE Std 1003.1) systems, it is also used to free memory obtained from calls to posix_memalign
and strdup
.
NAME
free - free allocated memory
SYNOPSIS
#include <stdlib.h> void free(void *ptr);
DESCRIPTION
The
free()
function frees the memory space pointed to by ptr, which must have been returned by a previous call tomalloc()
,calloc()
orrealloc()
. Otherwise, or if free(ptr) has already been called before, undefined behavior occurs. If ptr is NULL, no operation is performed.
RETURN VALUE
The
free()
function returns no value.
Wikipedia
References
- free - cppreference.com
- free - The Open Group Base Specifications Issue 7
- Ubuntu Manpage: malloc, free, calloc, realloc - Allocate and free dynamic memory
- Memory Allocation Routines - C Run-Time Library Reference (Visual Studio 2012)
- free - C Run-Time Library Reference (Visual Studio 2012)