free releases dynamically allocated storage after it is no longer needed. It belongs to the stdlib.h allocation interface alongside malloc, calloc, realloc, and aligned_alloc; these functions operate through void* pointers so the storage can serve any object type. section 13.1
Releasing a dynamically allocated vector
A program handling a large, variable collection—such as one double for each living person—can allocate storage on the fly and later release it with free. The allocation and release form a lifecycle: every allocation requires a corresponding free, although the calls need not occur in the same function. section 13.1 section 13.1.2
Use free only when its pointer argument satisfies the allocation rules:
- Pass a pointer returned by malloc, calloc, aligned_alloc, or realloc, or pass a null pointer. section 13.1.2
- Do not free an ordinary variable, a compound literal, a pointer into only part of an allocated object, or storage already freed. section 13.1.2
- Check allocation/free pairs to detect memory leaks, which can cause resource exhaustion, poor performance, or random crashes. section 13.1.2

