aboutsummaryrefslogtreecommitdiff
path: root/src/allocators.h
diff options
context:
space:
mode:
authorJonas Schnelli <jonas.schnelli@include7.ch>2013-06-03 15:18:41 +0200
committerJonas Schnelli <jonas.schnelli@include7.ch>2013-06-03 15:18:41 +0200
commit39fe9de6b2b255969971beca8fa25a33ad2e5750 (patch)
tree6686041f6b801d0ea5185b026a480a5be61510e6 /src/allocators.h
parentf679b2900a3a9f863f888cfb0b1a5e593628e37b (diff)
parentfa9e5adddda0bee5adc040b957cf3f1a6a470802 (diff)
Merge branch 'master' of git://github.com/bitcoin/bitcoin into prefsFix
Signed-off-by: Jonas Schnelli <jonas.schnelli@include7.ch> Conflicts: bitcoin-qt.pro
Diffstat (limited to 'src/allocators.h')
-rw-r--r--src/allocators.h13
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.
//