aboutsummaryrefslogtreecommitdiff
path: root/ModuleManager.py
diff options
context:
space:
mode:
Diffstat (limited to 'ModuleManager.py')
-rw-r--r--ModuleManager.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/ModuleManager.py b/ModuleManager.py
index d2457ae5..a05918cb 100644
--- a/ModuleManager.py
+++ b/ModuleManager.py
@@ -1,4 +1,4 @@
-import gc, glob, imp, inspect, os, sys, uuid
+import glob, imp, inspect, os, sys, uuid
class ModuleManager(object):
def __init__(self, bot, events, directory="modules"):
@@ -91,4 +91,10 @@ class ModuleManager(object):
self.events.purge_context(event_context)
del sys.modules[name]
+ references = sys.getrefcount(module)
del module
+ references -= 1 # 'del module' removes one reference
+ references -= 1 # one of the refs is from getrefcount
+
+ self.bot.log.info("Module '%s' unloaded (%d reference%s)",
+ [name, references, "" if references == 1 else "s"])