Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer


Frees a block of memory that was allocated with _aligned_malloc or _aligned_offset_malloc.

void _aligned_free (
   void *memblock



A pointer to the memory block that was returned to the _aligned_malloc or _aligned_offset_malloc function.

_aligned_free is marked __declspec(noalias), meaning that the function is guaranteed not to modify global variables. For more information, see noalias.

This function does not validate its parameter, unlike the other _aligned CRT functions. If memblock is a NULL pointer, this function simply performs no actions. It does not change errno and it does not invoke the invalid parameter handler. If an error occurs in the function due to not using _aligned functions previously to allocate the block of memory or a misalignment of memory occurs due to some unforeseen calamity, the function generates a debug report from the _RPT, _RPTF, _RPTW, _RPTFW Macros.

Routine Required header Compatibility



Windows 95, Windows 98, Windows 98 Second Edition, Windows Millennium Edition, Windows NT 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003

For more information, see _aligned_malloc.

Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.

© 2015 Microsoft