aboutsummaryrefslogtreecommitdiff
path: root/src/allocators.h
diff options
context:
space:
mode:
authorJonas Schnelli <[email protected]>2013-06-03 15:18:41 +0200
committerJonas Schnelli <[email protected]>2013-06-03 15:18:41 +0200
commit39fe9de6b2b255969971beca8fa25a33ad2e5750 (patch)
tree6686041f6b801d0ea5185b026a480a5be61510e6 /src/allocators.h
parentMaxOSX: settings fixes (#2371) (diff)
parentMerge pull request #2672 from Diapolo/Qt_testnet (diff)
downloaddiscoin-39fe9de6b2b255969971beca8fa25a33ad2e5750.tar.xz
discoin-39fe9de6b2b255969971beca8fa25a33ad2e5750.zip
Merge branch 'master' of git://github.com/bitcoin/bitcoin into prefsFix
Signed-off-by: Jonas Schnelli <[email protected]> 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 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.
//