aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-07-27 21:18:33 +0000
committerlloyd <[email protected]>2010-07-27 21:18:33 +0000
commit0c0655ea9c97618716fe2f11355e81b6f6a7a81b (patch)
tree0aae42e3071d83f8056e9e0f9bd630618feff6a5
parent3531f7981256d7ff45cdcb4c96d4f339c0db1b93 (diff)
Expose Algorithm_Factory::clear_caches which clears out all of the
caches; this might be useful for applications which are, say, particularly sensitive to memory usage.
-rw-r--r--src/algo_factory/algo_factory.cpp6
-rw-r--r--src/algo_factory/algo_factory.h5
2 files changed, 10 insertions, 1 deletions
diff --git a/src/algo_factory/algo_factory.cpp b/src/algo_factory/algo_factory.cpp
index 16ac589a1..6bd66d349 100644
--- a/src/algo_factory/algo_factory.cpp
+++ b/src/algo_factory/algo_factory.cpp
@@ -108,13 +108,17 @@ Algorithm_Factory::~Algorithm_Factory()
std::for_each(engines.begin(), engines.end(), del_fun<Engine>());
}
-void Algorithm_Factory::add_engine(Engine* engine)
+void Algorithm_Factory::clear_caches()
{
block_cipher_cache->clear_cache();
stream_cipher_cache->clear_cache();
hash_cache->clear_cache();
mac_cache->clear_cache();
+ }
+void Algorithm_Factory::add_engine(Engine* engine)
+ {
+ clear_caches();
engines.push_back(engine);
}
diff --git a/src/algo_factory/algo_factory.h b/src/algo_factory/algo_factory.h
index 5e0e49f13..f7e85202b 100644
--- a/src/algo_factory/algo_factory.h
+++ b/src/algo_factory/algo_factory.h
@@ -50,6 +50,11 @@ class BOTAN_DLL Algorithm_Factory
void add_engine(class Engine* engine);
/**
+ * Clear out any cached objects
+ */
+ void clear_caches();
+
+ /**
* @param algo_spec the algorithm we are querying
* @returns list of providers of this algorithm
*/