diff options
| author | Jeff Garzik <[email protected]> | 2013-05-30 07:55:25 -0700 |
|---|---|---|
| committer | Jeff Garzik <[email protected]> | 2013-05-30 07:55:25 -0700 |
| commit | e2f42142a03fa817a7fe6529fc1d55ef2d016352 (patch) | |
| tree | a298361e95260b418a2bf82665390441e954954e /src/allocators.h | |
| parent | Merge pull request #2693 from jgarzik/checkpoint-bool (diff) | |
| parent | Make signature cache store CPubKeys (diff) | |
| download | discoin-e2f42142a03fa817a7fe6529fc1d55ef2d016352.tar.xz discoin-e2f42142a03fa817a7fe6529fc1d55ef2d016352.zip | |
Merge pull request #2600 from sipa/keyrefactor
Refactor key.cpp/.h
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 eb2aed672..85af8fe37 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. // |