Only show reference counting if debugging is set
Since the garbage collection can be on a bit on the slow side it
shouldn't be done at a normal user's device.
A developer can still enable this by setting the configuration flag
"debug" to true.
@@ -42,6 +42,7 @@ ws = None
event_scheduler = None
skill_manager = None
+DEBUG = Configuration.get().get("debug", False)
skills_config = Configuration.get().get("skills")
BLACKLISTED_SKILLS = skills_config.get("blacklisted_skills", [])
PRIORITY_SKILLS = skills_config.get("priority_skills", [])
@@ -279,6 +280,7 @@ class SkillManager(Thread):
# removing listeners and stopping threads
skill["instance"].shutdown()
+ if DEBUG:
gc.collect() # Collect garbage to remove false references
# Remove two local references that are known
refs = sys.getrefcount(skill["instance"]) - 2
