From f7aca69727825b23e68e4fd6d441138d9353ce16 Mon Sep 17 00:00:00 2001 From: kishorenc Date: Fri, 10 Aug 2018 15:53:01 +0530 Subject: [PATCH] Clear the metrics dictionary on close. Otherwise, the dictionary is not being garbage collected and is leaking memory. --- kafka/metrics/metrics.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kafka/metrics/metrics.py b/kafka/metrics/metrics.py index e9c465deb..f2e99edc9 100644 --- a/kafka/metrics/metrics.py +++ b/kafka/metrics/metrics.py @@ -257,3 +257,5 @@ def close(self): """Close this metrics repository.""" for reporter in self._reporters: reporter.close() + + self._metrics.clear()