Use posix_madvise to purge pages when available
This commit is contained in:
parent
26c1dc5a3a
commit
4e3fe218e9
@ -332,6 +332,9 @@ pages_purge_lazy(void *addr, size_t size) {
|
||||
#elif defined(JEMALLOC_PURGE_MADVISE_DONTNEED) && \
|
||||
!defined(JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS)
|
||||
return (madvise(addr, size, MADV_DONTNEED) != 0);
|
||||
#elif defined(JEMALLOC_PURGE_POSIX_MADVISE_DONTNEED) && \
|
||||
!defined(JEMALLOC_PURGE_POSIX_MADVISE_DONTNEED_ZEROS)
|
||||
return (posix_madvise(addr, size, POSIX_MADV_DONTNEED) != 0);
|
||||
#else
|
||||
not_reached();
|
||||
#endif
|
||||
@ -349,6 +352,9 @@ pages_purge_forced(void *addr, size_t size) {
|
||||
#if defined(JEMALLOC_PURGE_MADVISE_DONTNEED) && \
|
||||
defined(JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS)
|
||||
return (madvise(addr, size, MADV_DONTNEED) != 0);
|
||||
#elif defined(JEMALLOC_PURGE_POSIX_MADVISE_DONTNEED) && \
|
||||
defined(JEMALLOC_PURGE_POSIX_MADVISE_DONTNEED_ZEROS)
|
||||
return (posix_madvise(addr, size, POSIX_MADV_DONTNEED) != 0);
|
||||
#elif defined(JEMALLOC_MAPS_COALESCE)
|
||||
/* Try to overlay a new demand-zeroed mapping. */
|
||||
return pages_commit(addr, size);
|
||||
|
Loading…
Reference in New Issue
Block a user