Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

posix_memalign(3) [netbsd man page]

POSIX_MEMALIGN(3)					   BSD Library Functions Manual 					 POSIX_MEMALIGN(3)

NAME
posix_memalign -- aligned memory allocation LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <stdlib.h> int posix_memalign(void **ptr, size_t alignment, size_t size); DESCRIPTION
The posix_memalign() function allocates size bytes of memory such that the allocation's base address is an even multiple of alignment, and returns the allocation in the value pointed to by ptr. The requested alignment must be a power of 2 at least as large as sizeof(void *). Memory that is allocated via posix_memalign() can be used as an argument in subsequent calls to realloc(3) and free(3). RETURN VALUES
The posix_memalign() function returns the value 0 if successful; otherwise it returns an error value. ERRORS
The posix_memalign() function will fail if: [EINVAL] The alignment parameter is not a power of 2 at least as large as sizeof(void *). [ENOMEM] Memory allocation error. SEE ALSO
free(3), malloc(3), realloc(3), valloc(3) STANDARDS
The posix_memalign() function conforms to IEEE Std 1003.1-2001 (``POSIX.1''). BSD
November 19, 2007 BSD

Check Out this Related Man Page

posix_memalign(3C)					   Standard C Library Functions 					posix_memalign(3C)

NAME
posix_memalign - aligned memory allocation SYNOPSIS
#include <sys/mman.h> int posix_memalign(void **memptr, size_t alignment, size_t size); DESCRIPTION
The posix_memalign() function allocates size bytes aligned on a boundary specified by alignment, and returns a pointer to the allocated memory in memptr. The value of alignment must be a power of two multiple of sizeof(void *). Upon successful completion, the value pointed to by memptr will be a multiple of alignment. If the size of the space requested is 0, the value returned in memptr will be a null pointer. The free(3C) function will deallocate memory that has previously been allocated by posix_memalign(). RETURN VALUES
Upon successful completion, posix_memalign() returns zero. Otherwise, an error number is returned to indicate the error. ERRORS
The posix_memalign() function will fail if: EINVAL The value of the alignment parameter is not a power of two multiple of sizeof(void *). ENOMEM There is insufficient memory available with the requested alignment. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Committed | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ |Standard |See standards(5). | +-----------------------------+-----------------------------+ SEE ALSO
free(3C), malloc(3C), memalign(3C), attributes(5), standards(5) SunOS 5.11 14 Jul 2008 posix_memalign(3C)
Man Page

8 More Discussions You Might Find Interesting

1. Windows & DOS: Issues & Discussions

error

Hi, I have problem: I installed office 2000 and I have an error in file: WINWORD.EXE :instruction base "0x0224145c" appeal to memory below address "0x00000000". Memory haven't 'written'. I have Athlon 1100 mHz, 256 mb ram and I don't know what is it. any help? thanks. regards. kezzol (3 Replies)
Discussion started by: kezzol
3 Replies

2. UNIX for Dummies Questions & Answers

Editing a large size file

I would like to edit a doc which is large file size. I can't use "vi" command due to out of memory. $ vi large.dat ex: 0602-101 Out of memory saving lines for undo. Please help. Thanks. (2 Replies)
Discussion started by: Rock
2 Replies

3. UNIX for Dummies Questions & Answers

tar: Memory allocation failed

tar: Memory allocation failed for extended data while reading : Not enough space what can be done for the above problem? top utility reports memory usage as follows: Memory: Real: 2688M/15G act/tot Virtual: 1492M/42915M use/tot Free: 11G this cannot be a disk space problem as we have... (1 Reply)
Discussion started by: gfhgfnhhn
1 Replies

4. HP-UX

Memory re-allocation Failure HP-UX for C++ module

HI I am getting core dump with "Memory re-allocation Failure" error can any one help me to get the possible reasons of getting this type of error, I am running the C++ code on HP-UX. Please help me thanx in advance (1 Reply)
Discussion started by: gyanusoni
1 Replies

5. Solaris

Error: Memory Address Not aligned

Hi, The following error message occured when I was trying to reboot my SUN machine: Memory address not aligned Its a Sun 280 R , Ultra SPARC III What should I do. Varma (3 Replies)
Discussion started by: gunnervarma
3 Replies

6. Programming

Memory allocation problem

I have a program that will fetch some particular lines and store it in a buffer for further operations.The code which is given below works but with some errors.I couldn't trace out the error.Can anybody help on this plz?? #include <stdio.h> #include <stdlib.h> #include<string.h> #define... (1 Reply)
Discussion started by: vigneshinbox
1 Replies

7. UNIX for Advanced & Expert Users

Out of Memory error when free memory size is large

I was running a program and it stopped and showed "Out of Memory!". at that time, the RAM used by this process is around 4G and the free memory size of the machine is around 30G. Does anybody know what maybe the reason? this program is written with Perl. the OS of the machine is Solaris U8. And I... (1 Reply)
Discussion started by: lilili07
1 Replies

8. Programming

Memory allocation in C

Hi Experts I need some help in static memory allocation in C. I have a program in which I declared 2 variables, one char array and one integer. I was little surprised to see the addresses of the variables. First: int x; char a; printf("%u %u\n', &x, a); I got the addresses displayed... (2 Replies)
Discussion started by: unx_freak
2 Replies