Provide advisory information about the expected use of memory
#include <sys/mman.h> int posix_madvise( void *addr, size_t len, int advice );
- The address of the data the application is providing advice about.
- The length of the data, in bytes.
- The advice to be applied to the memory range; one of the following:
- POSIX_MADV_NORMAL — the application has no advice to give on its behavior with respect to the specified range. This is the default characteristic if no advice is given for a range of memory.
- POSIX_MADV_SEQUENTIAL — the application expects to access the data sequentially from lower addresses to higher addresses.
- POSIX_MADV_RANDOM — the application expects to access the data in a random order.
- POSIX_MADV_WILLNEED — the application expects to access the data in the near future.
- POSIX_MADV_DONTNEED — the application expects that it won't access the data in the near future.
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The posix_madvise() function advises the memory manager how the application expects to use the data in the memory starting at address addr, and continuing for len bytes. The memory manager may use this information to optimize handling of the data.
- The value of advice is invalid.
- Addresses in the specified range are partly or completely outside the range allowed for the address space of the calling process.