diff options
Diffstat (limited to 'src/allocators.h')
-rw-r--r-- | src/allocators.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/allocators.h b/src/allocators.h index eb2aed6721..85af8fe376 100644 --- a/src/allocators.h +++ b/src/allocators.h @@ -177,6 +177,19 @@ private: }; // +// Functions for directly locking/unlocking memory objects. +// Intended for non-dynamically allocated structures. +// +template<typename T> void LockObject(const T &t) { + LockedPageManager::instance.LockRange((void*)(&t), sizeof(T)); +} + +template<typename T> void UnlockObject(const T &t) { + OPENSSL_cleanse((void*)(&t), sizeof(T)); + LockedPageManager::instance.UnlockRange((void*)(&t), sizeof(T)); +} + +// // Allocator that locks its contents from being paged // out of memory and clears its contents before deletion. // |