From a6bee87990d3fd36cbb8e63716990a46fe00402c Mon Sep 17 00:00:00 2001 From: Yotam Barnoy Date: Fri, 5 Nov 2010 13:24:57 +0000 Subject: PLUGINS: improved one-at-a-time plugin code I reduced memory fragmentation using 2 principles: Plugins should be loaded for as little time as possible, and long lasting memory allocations should be allocated before plugins are loaded. There might still be a little fragmentation left. Note that command line settings that require plugins to be loaded don't work yet, but they didn't work (properly) before either. svn-id: r54097 --- base/plugins.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'base/plugins.h') diff --git a/base/plugins.h b/base/plugins.h index 5472ab2fce..fc8adbf0d4 100644 --- a/base/plugins.h +++ b/base/plugins.h @@ -301,17 +301,14 @@ protected: class PluginManager : public Common::Singleton { typedef Common::Array ProviderList; private: - PluginList _plugins[PLUGIN_TYPE_MAX]; + PluginList _pluginsInMem[PLUGIN_TYPE_MAX]; ProviderList _providers; - PluginList _allPlugs; + PluginList _allEnginePlugins; PluginList::iterator _currentPlugin; - bool _skipStaticPlugs; - - uint _nonEnginePlugs; - bool tryLoadPlugin(Plugin *plugin); + void addToPluginsInMemList(Plugin *plugin); friend class Common::Singleton; PluginManager(); @@ -321,14 +318,15 @@ public: void addPluginProvider(PluginProvider *pp); + void loadNonEnginePluginsAndEnumerate(); void loadFirstPlugin(); bool loadNextPlugin(); void loadPlugins(); void unloadPlugins(); - void unloadPluginsExcept(PluginType type, const Plugin *plugin); + void unloadPluginsExcept(PluginType type, const Plugin *plugin, bool deletePlugin = true); - const PluginList &getPlugins(PluginType t) { return _plugins[t]; } + const PluginList &getPlugins(PluginType t) { return _pluginsInMem[t]; } }; #endif -- cgit v1.2.3