summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-01-23 16:19:14 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-01-23 16:19:14 +0000
commitcb722191584309094ce0a57b95000e2e0751988d (patch)
tree0808d13ea1783b501352f4a2e4791a03f8096a99
parent43951783f3185c6ae3d64f27f6f3462724dda689 (diff)
Memory optimizations in plugin management (useful on rescans)
-rw-r--r--lib/rbot/plugins.rb27
1 files changed, 18 insertions, 9 deletions
diff --git a/lib/rbot/plugins.rb b/lib/rbot/plugins.rb
index 66a7d842..564495e0 100644
--- a/lib/rbot/plugins.rb
+++ b/lib/rbot/plugins.rb
@@ -252,19 +252,28 @@ module Plugins
attr_reader :botmodules
def initialize
- bot_associate(nil)
-
- @dirs = []
- end
-
- # Reset lists of botmodules
- def reset_botmodule_lists
@botmodules = {
:CoreBotModule => [],
:Plugin => []
}
+
@names_hash = Hash.new
@commandmappers = Hash.new
+
+ @dirs = []
+
+ @failed = Array.new
+ @ignored = Array.new
+
+ bot_associate(nil)
+ end
+
+ # Reset lists of botmodules
+ def reset_botmodule_lists
+ @botmodules[:CoreBotModule].clear
+ @botmodules[:Plugin].clear
+ @names_hash.clear
+ @commandmappers.clear
end
# Associate with bot _bot_
@@ -380,8 +389,8 @@ module Plugins
# load plugins from pre-assigned list of directories
def scan
- @failed = Array.new
- @ignored = Array.new
+ @failed.clear
+ @ignored.clear
processed = Hash.new
@bot.config['plugins.blacklist'].each { |p|