Standards / Extensions | C or C++ | Dependencies |
---|---|---|
XPG4.2 | both |
#define _XOPEN_SOURCE_EXTENDED 1
#include <stdlib.h>
void *valloc(size_t size);
The valloc() function has the same effect as malloc(), except that the allocated memory will be aligned to a multiple of the value returned by sysconf(_SC_PAGESIZE).
Special behavior for C++: The C++ keywords new and delete are not interoperable with valloc(), calloc(), free(), malloc(), or realloc().
This function is kept for historical reasons. It was part of the Legacy Feature in Single UNIX Specification, Version 2, but has been withdrawn and is not supported as part of Single UNIX Specification, Version 3. The malloc() or mmap() functions are preferred for portability.
If it is necessary to continue using this function in an application written for Single UNIX Specification, Version 3, define the feature test macro _UNIX03_WITHDRAWN before including any standard system headers. The macro exposes all interfaces and symbols removed in Single UNIX Specification, Version 3.
If successful, valloc() returns a pointer to the reserved storage. The storage space to which the returned value points is guaranteed to be aligned on a page boundary.