Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference (Volume 6 of 9): Section 3: Library Functions (A-M) > m

memalign(3C)

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

memalign() — allocate aligned memory

SYNOPSIS

#include <stdlib.h>

void *memalign(size_t boundary, size_t size);

DESCRIPTION

memalign() allocates space for a block of size bytes, whose address is a multiple of boundary. The space is not initialized. The boundary must be a power of 2.

APPLICATION USAGE

memalign() is thread-safe. It is not async-cancel-safe.

RETURN VALUE

Upon successful completion, memalign() returns a pointer to space aligned to a multiple of boundary. Otherwise, it returns a NULL pointer.

DIAGNOSTICS

memalign() returns a NULL pointer if there is no available memory, or if the value of boundary is not a power of 2.

ERRORS

[ENOMEM]

memalign() sets errno to ENOMEM and returns a NULL pointer when an out-of-memory condition arises.

[EINVAL]

memalign() sets errno to EINVAL and returns a NULL pointer when the value of boundary is not a power of 2.

[EINVAL]

memalign() sets errno to EINVAL and returns a NULL pointer when the memory being managed by malloc() has been detectably corrupted.

EXTERNAL INFLUENCES

memalign() employs the malloc(3C) allocator. For tuning information, see the malloc(3C) man page.

WARNINGS

For warnings, see the malloc(3C) man page.

COMPATIBILITY

memalign() has not previously been available on HP-UX.

STANDARDS CONFORMANCE

There appear to be no standards applicable to memalign(). Some implementations do not check that boundary is a power of 2. The HP-UX implementation is not derived from any predecessor.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2000 Hewlett-Packard Development Company, L.P.