aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstate
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-03-13 18:34:20 +0000
committerlloyd <[email protected]>2010-03-13 18:34:20 +0000
commit2fbe098b29b9ca611d83d8aedb7457dc925860eb (patch)
tree16085502d8637e29df59dcd92a4aeb98c899ea32 /src/libstate
parentbdb4cd3df0e2ed94d39cff95a83fcd88141c1ef4 (diff)
At startup, test if lock_mem() at least seems to work. If it doesn't,
immediately fall back the the plain malloc-based allocator, which is typically quite a bit faster.
Diffstat (limited to 'src/libstate')
-rw-r--r--src/libstate/libstate.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libstate/libstate.cpp b/src/libstate/libstate.cpp
index b461c1ef8..7706cef28 100644
--- a/src/libstate/libstate.cpp
+++ b/src/libstate/libstate.cpp
@@ -14,6 +14,7 @@
#include <botan/internal/mutex.h>
#include <botan/internal/mux_noop.h>
#include <botan/internal/stl_util.h>
+#include <botan/internal/mlock.h>
#include <algorithm>
#if defined(BOTAN_HAS_SELFTESTS)
@@ -252,7 +253,7 @@ void Library_State::initialize(bool thread_safe)
config_lock = mutex_factory->make();
cached_default_allocator = 0;
- default_allocator_name = "locking";
+ default_allocator_name = has_mlock() ? "locking" : "malloc";
add_allocator(new Malloc_Allocator);
add_allocator(new Locking_Allocator(mutex_factory->make()));