From a28ff745cc2a45df81bb34a56ca0294ece0b4087 Mon Sep 17 00:00:00 2001 From: imarom Date: Mon, 19 Dec 2016 14:51:24 +0200 Subject: PYZMQ memory leakage: see this: https://github.com/zeromq/pyzmq/issues/767 and this: https://github.com/minrk/pyzmq/commit/51bbb2d2e3197343d7cfe0aa6d500b61e63c7b01 Signed-off-by: imarom --- .../python2/cel59/32bit/zmq/sugar/context.py | 20 +++++++++----------- .../python2/cel59/64bit/zmq/sugar/context.py | 20 +++++++++----------- .../python2/fedora18/64bit/zmq/sugar/context.py | 20 +++++++++----------- .../python3/cel59/32bit/zmq/sugar/context.py | 20 +++++++++----------- .../python3/cel59/64bit/zmq/sugar/context.py | 20 +++++++++----------- .../python3/fedora18/64bit/zmq/sugar/context.py | 20 +++++++++----------- 6 files changed, 54 insertions(+), 66 deletions(-) diff --git a/scripts/external_libs/pyzmq-14.5.0/python2/cel59/32bit/zmq/sugar/context.py b/scripts/external_libs/pyzmq-14.5.0/python2/cel59/32bit/zmq/sugar/context.py index 86a9c5dc..692e0256 100644 --- a/scripts/external_libs/pyzmq-14.5.0/python2/cel59/32bit/zmq/sugar/context.py +++ b/scripts/external_libs/pyzmq-14.5.0/python2/cel59/32bit/zmq/sugar/context.py @@ -5,7 +5,6 @@ # Distributed under the terms of the Modified BSD License. import atexit -import weakref from zmq.backend import Context as ContextBase from . import constants @@ -14,6 +13,14 @@ from .constants import ENOTSUP, ctx_opt_names from .socket import Socket from zmq.error import ZMQError +# notice when exiting, to avoid triggering term on exit +_exiting = False +def _notice_atexit(): + global _exiting + _exiting = True +atexit.register(_notice_atexit) + + from zmq.utils.interop import cast_int_addr @@ -25,7 +32,6 @@ class Context(ContextBase, AttributeSetter): sockopts = None _instance = None _shadow = False - _exiting = False def __init__(self, io_threads=1, **kwargs): super(Context, self).__init__(io_threads=io_threads, **kwargs) @@ -35,18 +41,10 @@ class Context(ContextBase, AttributeSetter): self._shadow = False self.sockopts = {} - self._exiting = False - if not self._shadow: - ctx_ref = weakref.ref(self) - def _notify_atexit(): - ctx = ctx_ref() - if ctx is not None: - ctx._exiting = True - atexit.register(_notify_atexit) def __del__(self): """deleting a Context should terminate it, without trying non-threadsafe destroy""" - if not self._shadow and not self._exiting: + if not self._shadow and not _exiting: self.term() def __enter__(self): diff --git a/scripts/external_libs/pyzmq-14.5.0/python2/cel59/64bit/zmq/sugar/context.py b/scripts/external_libs/pyzmq-14.5.0/python2/cel59/64bit/zmq/sugar/context.py index 86a9c5dc..692e0256 100644 --- a/scripts/external_libs/pyzmq-14.5.0/python2/cel59/64bit/zmq/sugar/context.py +++ b/scripts/external_libs/pyzmq-14.5.0/python2/cel59/64bit/zmq/sugar/context.py @@ -5,7 +5,6 @@ # Distributed under the terms of the Modified BSD License. import atexit -import weakref from zmq.backend import Context as ContextBase from . import constants @@ -14,6 +13,14 @@ from .constants import ENOTSUP, ctx_opt_names from .socket import Socket from zmq.error import ZMQError +# notice when exiting, to avoid triggering term on exit +_exiting = False +def _notice_atexit(): + global _exiting + _exiting = True +atexit.register(_notice_atexit) + + from zmq.utils.interop import cast_int_addr @@ -25,7 +32,6 @@ class Context(ContextBase, AttributeSetter): sockopts = None _instance = None _shadow = False - _exiting = False def __init__(self, io_threads=1, **kwargs): super(Context, self).__init__(io_threads=io_threads, **kwargs) @@ -35,18 +41,10 @@ class Context(ContextBase, AttributeSetter): self._shadow = False self.sockopts = {} - self._exiting = False - if not self._shadow: - ctx_ref = weakref.ref(self) - def _notify_atexit(): - ctx = ctx_ref() - if ctx is not None: - ctx._exiting = True - atexit.register(_notify_atexit) def __del__(self): """deleting a Context should terminate it, without trying non-threadsafe destroy""" - if not self._shadow and not self._exiting: + if not self._shadow and not _exiting: self.term() def __enter__(self): diff --git a/scripts/external_libs/pyzmq-14.5.0/python2/fedora18/64bit/zmq/sugar/context.py b/scripts/external_libs/pyzmq-14.5.0/python2/fedora18/64bit/zmq/sugar/context.py index 86a9c5dc..692e0256 100644 --- a/scripts/external_libs/pyzmq-14.5.0/python2/fedora18/64bit/zmq/sugar/context.py +++ b/scripts/external_libs/pyzmq-14.5.0/python2/fedora18/64bit/zmq/sugar/context.py @@ -5,7 +5,6 @@ # Distributed under the terms of the Modified BSD License. import atexit -import weakref from zmq.backend import Context as ContextBase from . import constants @@ -14,6 +13,14 @@ from .constants import ENOTSUP, ctx_opt_names from .socket import Socket from zmq.error import ZMQError +# notice when exiting, to avoid triggering term on exit +_exiting = False +def _notice_atexit(): + global _exiting + _exiting = True +atexit.register(_notice_atexit) + + from zmq.utils.interop import cast_int_addr @@ -25,7 +32,6 @@ class Context(ContextBase, AttributeSetter): sockopts = None _instance = None _shadow = False - _exiting = False def __init__(self, io_threads=1, **kwargs): super(Context, self).__init__(io_threads=io_threads, **kwargs) @@ -35,18 +41,10 @@ class Context(ContextBase, AttributeSetter): self._shadow = False self.sockopts = {} - self._exiting = False - if not self._shadow: - ctx_ref = weakref.ref(self) - def _notify_atexit(): - ctx = ctx_ref() - if ctx is not None: - ctx._exiting = True - atexit.register(_notify_atexit) def __del__(self): """deleting a Context should terminate it, without trying non-threadsafe destroy""" - if not self._shadow and not self._exiting: + if not self._shadow and not _exiting: self.term() def __enter__(self): diff --git a/scripts/external_libs/pyzmq-14.5.0/python3/cel59/32bit/zmq/sugar/context.py b/scripts/external_libs/pyzmq-14.5.0/python3/cel59/32bit/zmq/sugar/context.py index 86a9c5dc..692e0256 100644 --- a/scripts/external_libs/pyzmq-14.5.0/python3/cel59/32bit/zmq/sugar/context.py +++ b/scripts/external_libs/pyzmq-14.5.0/python3/cel59/32bit/zmq/sugar/context.py @@ -5,7 +5,6 @@ # Distributed under the terms of the Modified BSD License. import atexit -import weakref from zmq.backend import Context as ContextBase from . import constants @@ -14,6 +13,14 @@ from .constants import ENOTSUP, ctx_opt_names from .socket import Socket from zmq.error import ZMQError +# notice when exiting, to avoid triggering term on exit +_exiting = False +def _notice_atexit(): + global _exiting + _exiting = True +atexit.register(_notice_atexit) + + from zmq.utils.interop import cast_int_addr @@ -25,7 +32,6 @@ class Context(ContextBase, AttributeSetter): sockopts = None _instance = None _shadow = False - _exiting = False def __init__(self, io_threads=1, **kwargs): super(Context, self).__init__(io_threads=io_threads, **kwargs) @@ -35,18 +41,10 @@ class Context(ContextBase, AttributeSetter): self._shadow = False self.sockopts = {} - self._exiting = False - if not self._shadow: - ctx_ref = weakref.ref(self) - def _notify_atexit(): - ctx = ctx_ref() - if ctx is not None: - ctx._exiting = True - atexit.register(_notify_atexit) def __del__(self): """deleting a Context should terminate it, without trying non-threadsafe destroy""" - if not self._shadow and not self._exiting: + if not self._shadow and not _exiting: self.term() def __enter__(self): diff --git a/scripts/external_libs/pyzmq-14.5.0/python3/cel59/64bit/zmq/sugar/context.py b/scripts/external_libs/pyzmq-14.5.0/python3/cel59/64bit/zmq/sugar/context.py index 86a9c5dc..692e0256 100644 --- a/scripts/external_libs/pyzmq-14.5.0/python3/cel59/64bit/zmq/sugar/context.py +++ b/scripts/external_libs/pyzmq-14.5.0/python3/cel59/64bit/zmq/sugar/context.py @@ -5,7 +5,6 @@ # Distributed under the terms of the Modified BSD License. import atexit -import weakref from zmq.backend import Context as ContextBase from . import constants @@ -14,6 +13,14 @@ from .constants import ENOTSUP, ctx_opt_names from .socket import Socket from zmq.error import ZMQError +# notice when exiting, to avoid triggering term on exit +_exiting = False +def _notice_atexit(): + global _exiting + _exiting = True +atexit.register(_notice_atexit) + + from zmq.utils.interop import cast_int_addr @@ -25,7 +32,6 @@ class Context(ContextBase, AttributeSetter): sockopts = None _instance = None _shadow = False - _exiting = False def __init__(self, io_threads=1, **kwargs): super(Context, self).__init__(io_threads=io_threads, **kwargs) @@ -35,18 +41,10 @@ class Context(ContextBase, AttributeSetter): self._shadow = False self.sockopts = {} - self._exiting = False - if not self._shadow: - ctx_ref = weakref.ref(self) - def _notify_atexit(): - ctx = ctx_ref() - if ctx is not None: - ctx._exiting = True - atexit.register(_notify_atexit) def __del__(self): """deleting a Context should terminate it, without trying non-threadsafe destroy""" - if not self._shadow and not self._exiting: + if not self._shadow and not _exiting: self.term() def __enter__(self): diff --git a/scripts/external_libs/pyzmq-14.5.0/python3/fedora18/64bit/zmq/sugar/context.py b/scripts/external_libs/pyzmq-14.5.0/python3/fedora18/64bit/zmq/sugar/context.py index 86a9c5dc..692e0256 100644 --- a/scripts/external_libs/pyzmq-14.5.0/python3/fedora18/64bit/zmq/sugar/context.py +++ b/scripts/external_libs/pyzmq-14.5.0/python3/fedora18/64bit/zmq/sugar/context.py @@ -5,7 +5,6 @@ # Distributed under the terms of the Modified BSD License. import atexit -import weakref from zmq.backend import Context as ContextBase from . import constants @@ -14,6 +13,14 @@ from .constants import ENOTSUP, ctx_opt_names from .socket import Socket from zmq.error import ZMQError +# notice when exiting, to avoid triggering term on exit +_exiting = False +def _notice_atexit(): + global _exiting + _exiting = True +atexit.register(_notice_atexit) + + from zmq.utils.interop import cast_int_addr @@ -25,7 +32,6 @@ class Context(ContextBase, AttributeSetter): sockopts = None _instance = None _shadow = False - _exiting = False def __init__(self, io_threads=1, **kwargs): super(Context, self).__init__(io_threads=io_threads, **kwargs) @@ -35,18 +41,10 @@ class Context(ContextBase, AttributeSetter): self._shadow = False self.sockopts = {} - self._exiting = False - if not self._shadow: - ctx_ref = weakref.ref(self) - def _notify_atexit(): - ctx = ctx_ref() - if ctx is not None: - ctx._exiting = True - atexit.register(_notify_atexit) def __del__(self): """deleting a Context should terminate it, without trying non-threadsafe destroy""" - if not self._shadow and not self._exiting: + if not self._shadow and not _exiting: self.term() def __enter__(self): -- cgit 1.2.3-korg