diff --git a/src/support/lockedpool.cpp b/src/support/lockedpool.cpp index 5f9bb6d6f8..05d8724992 100644 --- a/src/support/lockedpool.cpp +++ b/src/support/lockedpool.cpp @@ -231,6 +231,11 @@ void *PosixLockedPageAllocator::AllocateLocked(size_t len, bool *lockingSuccess) addr = mmap(nullptr, len, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); if (addr) { *lockingSuccess = mlock(addr, len) == 0; +#if defined(MADV_DONTDUMP) // Linux + madvise(addr, len, MADV_DONTDUMP); +#elif defined(MADV_NOCORE) // FreeBSD + madvise(addr, len, MADV_NOCORE); +#endif } return addr; }