---
name: "free_aligned_sized"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/free_aligned_sized"
---

# free\_aligned\_sized(3)

C23 sized deallocation functions

## NAME

**free\_sized**, **free\_aligned\_sized** – C23 sized deallocation functions

## SYNOPSIS

Standard C Library (libc, -lc)

**#include \<stdlib.h\>**

*void*\

**free\_sized**(*void \*ptr*, *size\_t size*);

*void*\

**free\_aligned\_sized**(*void \*ptr*, *size\_t alignment*, *size\_t size*);

## DESCRIPTION

The **free\_sized**() function deallocates the memory referenced by *ptr* that was previously allocated by [malloc(3)](/malloc/3.md), [realloc(3)](/realloc/3.md), or [calloc(3)](/calloc/3.md). The *size* argument shall equal the size passed to the allocation function. The result of an [aligned\_alloc(3)](/aligned_alloc/3.md) may not be passed to **free\_sized**().

The **free\_aligned\_sized**() function deallocates memory referenced by *ptr* that was previously allocated by [aligned\_alloc(3)](/aligned_alloc/3.md). The *alignment* and *size* arguments shall equal the values supplied to the allocation function. The result of an [malloc(3)](/malloc/3.md), [calloc(3)](/calloc/3.md), or [realloc(3)](/realloc/3.md) may not be passed to **free\_aligned\_sized**().

If *ptr* is neither a null pointer nor a pointer returned by the allocation functions described above for the corresponding deallocation function, the behaviour is undefined, and so is supplying a *size* or *alignment* that does not match the original allocation.

## IMPLEMENTATION NOTES

The C standard permits an implementation to ignore the *size* and *alignment* hints. The current implementation forwards to [free(3)](/free/3.md) without validating these arguments, so behaviour remains correct for well-formed use.

These functions will be wired to the system allocator's sized deallocation, once supported, as with the rest of the memory allocation API, so that *size* and *alignment* hints are used for performance and security benefits. That behaviour conforms to the practice recommended for each function in the C standard.

## SEE ALSO

[aligned\_alloc(3)](/aligned_alloc/3.md), [calloc(3)](/calloc/3.md), [free(3)](/free/3.md), [jemalloc(3)](/jemalloc/3.md), [malloc(3)](/malloc/3.md), [realloc(3)](/realloc/3.md)

## STANDARDS

The **free\_sized**() and **free\_aligned\_sized**() functions conform to ISO/IEC 9899:2024 (“ISO C23”).

## AUTHOR

Faraz Vahedi ⟨*kfv@kfv.io*⟩
