[python-dtcwt] 213/497: fix memory leak in OpenCL implementation
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Tue Jul 21 18:06:06 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch debian/sid
in repository python-dtcwt.
commit 9f18d4a99bfa01720d1c031e1d94a97cc9d3cd6b
Author: Rich Wareham <rjw57 at cam.ac.uk>
Date: Wed Nov 20 16:31:35 2013 +0000
fix memory leak in OpenCL implementation
The lowpass, subbands and scales properties of
backend_opencl.TransformDomainSignal were indeed memoized but memoized
globally meaning that referencing them would keep a reference to the
TransformDomainSignal object indefinitely leading to memory growing
without bound. Replace the @memoize decorator with a simple
attribute-based cache.
---
dtcwt/backend/backend_opencl/transform2d.py | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/dtcwt/backend/backend_opencl/transform2d.py b/dtcwt/backend/backend_opencl/transform2d.py
index ee674d2..7d7b729 100644
--- a/dtcwt/backend/backend_opencl/transform2d.py
+++ b/dtcwt/backend/backend_opencl/transform2d.py
@@ -67,19 +67,22 @@ class TransformDomainSignal(object):
self.cl_scales = scales
@property
- @memoize
def lowpass(self):
- return to_array(self.cl_lowpass) if self.cl_lowpass is not None else None
+ if not hasattr(self, '_lowpass'):
+ self._lowpass = to_array(self.cl_lowpass) if self.cl_lowpass is not None else None
+ return self._lowpass
@property
- @memoize
def subbands(self):
- return tuple(to_array(x) for x in self.cl_subbands) if self.cl_subbands is not None else None
+ if not hasattr(self, '_subbands'):
+ self._subbands = tuple(to_array(x) for x in self.cl_subbands) if self.cl_subbands is not None else None
+ return self._subbands
@property
- @memoize
def scales(self):
- return tuple(to_array(x) for x in self.cl_scales) if self.cl_scales is not None else None
+ if not hasattr(self, '_scales'):
+ self._scales = tuple(to_array(x) for x in self.cl_scales) if self.cl_scales is not None else None
+ return self._scales
class Transform2d(Transform2dNumPy):
"""
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-dtcwt.git
More information about the debian-science-commits
mailing list