Operating systems, development tools, and professional services
for connected embedded systems
for connected embedded systems
![]() |
![]() |
![]() |
![]() |
memalign()
Allocate aligned memory
Synopsis:
#include <malloc.h>
void *memalign( size_t alignment,
size_t size );
Arguments:
- alignment
- The alignment that you want to use for the memory. This must be a multiple of size( void *).
- size
- The amount of memory you want to allocate, in bytes.
Library:
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
Description:
The memalign() function allocates size bytes aligned on a boundary specified by alignment.
Returns:
A pointer to the allocated block, or NULL if an error occurred (errno is set).
Errors:
- EINVAL
- The value of alignment isn't a multiple of size( void *).
- ENOMEM
- There's insufficient memory available with the requested alignment.
Classification:
| Safety: | |
|---|---|
| Cancellation point | No |
| Interrupt handler | No |
| Signal handler | Yes |
| Thread | Yes |
See also:
free(), malloc(), posix_memalign()
![]() |
![]() |
![]() |
![]() |

![[Previous]](../prev.gif)
![[Contents]](../contents.gif)
![[Index]](../keyword_index.gif)
![[Next]](../next.gif)