diff options
author | lloyd <[email protected]> | 2014-04-14 23:08:09 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2014-04-14 23:08:09 +0000 |
commit | c4d7caf1efb11e88ffe824760946b2e38f7d39db (patch) | |
tree | 347484f01edb79441ef5a56b4e04db5f33bc4b07 /src/lib | |
parent | 340cc7f520ef95aeb7a4692357b870003dd7f0f8 (diff) |
Use MADV_DONTDUMP on Linux, equiv to MAP_NOCORE on BSD
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/alloc/locking_allocator/locking_allocator.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/alloc/locking_allocator/locking_allocator.cpp b/src/lib/alloc/locking_allocator/locking_allocator.cpp index 8e3f7e142..4b66ea018 100644 --- a/src/lib/alloc/locking_allocator/locking_allocator.cpp +++ b/src/lib/alloc/locking_allocator/locking_allocator.cpp @@ -1,6 +1,6 @@ /* * Mlock Allocator -* (C) 2012 Jack Lloyd +* (C) 2012,2014 Jack Lloyd * * Distributed under the terms of the Botan license */ @@ -250,6 +250,10 @@ mlock_allocator::mlock_allocator() : throw std::runtime_error("Could not mlock " + std::to_string(m_poolsize) + " bytes"); } +#if defined(MADV_DONTDUMP) + ::madvise(m_pool, m_poolsize, MADV_DONTDUMP); +#endif + m_freelist.push_back(std::make_pair(0, m_poolsize)); } } |