free_aligned_sized

From cppreference.com
< c‎ | memory
Defined in header <stdlib.h>
void free_aligned_sized( void * ptr, size_t alignment, size_t size ) ;
(since C23)

If ptr is a null pointer or the result obtained from a call to aligned_alloc, where alignment is equal to the requested allocation alignment and size is equal to the requested allocation size, this function is equivalent to free(ptr)

The result of an malloc, calloc, or realloc call may not be passed to free_aligned_sized

free_aligned_sized is thread-safe: it behaves as though only accessing the memory locations visible through its argument, and not any static storage.

A call to free_aligned_sized that deallocates a region of memory synchronizes-with

Parameters

ptr - pointer to the memory to deallocate
alignment - alignment of memory to deallocate
size - size of memory to deallocate

Return value

(none)

Example

References

  • C23 standard (ISO/IEC 9899:2024):
  • 7.24.3.5 The free_sized function (p: 366)

See also

allocates aligned memory
(function)
deallocates previously allocated memory
(function)
(C23)
deallocates previously allocated sized memory
(function)
allocates memory
(function)