From cb722191584309094ce0a57b95000e2e0751988d Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Tue, 23 Jan 2007 16:19:14 +0000 Subject: Memory optimizations in plugin management (useful on rescans) --- lib/rbot/plugins.rb | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'lib/rbot/plugins.rb') 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| -- cgit v1.2.3