MADVISE(2)                                                          MADVISE(2)


NAME
     madvise - give advice about handling memory

SYNOPSIS
     #include <sys/mman.h>

     int madvise (void *addr, size_t len, int behavior);

DESCRIPTION
     madvise provides the system advice about the process' expected use of its
     address space from addr to addr + len.

     The following types of behavior are currently recognized by the system:

     MADV_DONTNEED    informs the system that the address range from addr to
                      addr + len will likely not be referenced in the near
                      future.  The memory to which the indicated addresses are
                      mapped will be the first to be reclaimed when memory is
                      needed by the system.

     madvise will fail if:

     [ENOMEM]       Addresses in the range (addr, addr + len) are outside the
                    valid range for the address space of the process.

     [EINVAL]       behavior is not recognized by the system.

SEE ALSO
     mmap(2), msync(2).

DIAGNOSTICS
     A 0 value is returned on success; a -1 value indicates an error.

BUGS
     MADV_DONTNEED advice is currently only heeded for memory mapped via
     explicit mmap(2) system calls.


                                                                        Page 1