'\" t .\" Copyright, the authors of the Linux man-pages project .\" .\" SPDX-License-Identifier: Linux-man-pages-copyleft .\" .TH memalign 3 2025-12-13 "Linux man-pages 6.18" .SH NAME memalign \- allocate aligned memory .SH LIBRARY Standard C library .RI ( libc ,\~ \-lc ) .SH SYNOPSIS .nf .B #include .P .BI "[[deprecated]] void *memalign(size_t " alignment ", size_t " size ); .fi .SH DESCRIPTION .BR memalign () is equivalent to .BR aligned_alloc (3), except for the CAVEATS documented below. .\" The behavior of memalign() for size==0 is as for posix_memalign() .\" but no standards govern this. .SH ATTRIBUTES For an explanation of the terms used in this section, see .BR attributes (7). .TS allbox; lbx lb lb l l l. Interface Attribute Value T{ .na .nh .BR memalign () T} Thread safety MT-Safe .TE .SH VERSIONS On some systems .BR memalign () is declared in .I instead of .IR . .SH STANDARDS None. .SH HISTORY glibc 2.0. SunOS 4.1.3. .SH CAVEATS .BR memalign () may not check that the .I alignment argument is correct. .P Some systems provide no way to reclaim memory allocated with .BR memalign () (because one can pass to .BR free (3) only a pointer obtained from .BR malloc (3), while, for example, .BR memalign () would call .BR malloc (3) and then align the obtained value). The glibc implementation allows memory obtained from .BR memalign () to be reclaimed with .BR free (3). .SH SEE ALSO .BR aligned_alloc (3)