From 2fbe098b29b9ca611d83d8aedb7457dc925860eb Mon Sep 17 00:00:00 2001 From: lloyd Date: Sat, 13 Mar 2010 18:34:20 +0000 Subject: 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. --- src/libstate/libstate.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/libstate') 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 #include #include +#include #include #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())); -- cgit v1.2.3