From 3890145e82298ee266dc30b47328f046805619bc Mon Sep 17 00:00:00 2001 From: kormax <3392860+kormax@users.noreply.github.com> Date: Fri, 8 Mar 2024 23:27:41 +0200 Subject: [PATCH 1/2] Fix _QThreadWorker.run not releasing references to fulfilled command object before blocking on next queue.get call --- qasync/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/qasync/__init__.py b/qasync/__init__.py index 3363e97..8c5a02f 100644 --- a/qasync/__init__.py +++ b/qasync/__init__.py @@ -152,6 +152,9 @@ def run(self): else: self._logger.debug("Future was canceled") + # Delete references + del command, future, callback, args, kwargs + self._logger.debug("Thread #%s stopped", self.__num) def wait(self): From d019e53a8327ec8a64771d2a577f64d22335d525 Mon Sep 17 00:00:00 2001 From: kormax <3392860+kormax@users.noreply.github.com> Date: Sat, 9 Mar 2024 00:22:32 +0200 Subject: [PATCH 2/2] Fix _QThreadWorker.run not releasing reference to r(esult) too --- qasync/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/qasync/__init__.py b/qasync/__init__.py index 8c5a02f..f797c85 100644 --- a/qasync/__init__.py +++ b/qasync/__init__.py @@ -149,6 +149,9 @@ def run(self): else: self._logger.debug("Setting Future result: %s", r) future.set_result(r) + finally: + # Release potential reference + r = None # noqa else: self._logger.debug("Future was canceled")