[python-arrayfire] 107/250: Fix memory leak

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Mar 28 22:59:37 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/master
in repository python-arrayfire.

commit 7ef5bc9e719c393d8bf68aa31d89140ce3581f5b
Author: Filipe Maia <filipe.c.maia at gmail.com>
Date:   Mon Sep 7 16:55:11 2015 +0200

    Fix memory leak
---
 arrayfire/array.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arrayfire/array.py b/arrayfire/array.py
index 9d16036..14f4880 100644
--- a/arrayfire/array.py
+++ b/arrayfire/array.py
@@ -894,8 +894,10 @@ class Array(BaseArray):
             if (is_number(val)):
                 tdims = _get_assign_dims(key, self.dims())
                 other_arr = constant_array(val, tdims[0], tdims[1], tdims[2], tdims[3], self.type())
+                del_other = True
             else:
                 other_arr = val.arr
+                del_other = False
 
             out_arr = ct.c_void_p(0)
             inds  = _get_indices(key)
@@ -904,6 +906,8 @@ class Array(BaseArray):
                                          self.arr, ct.c_longlong(n_dims), ct.pointer(inds),
                                          other_arr))
             safe_call(backend.get().af_release_array(self.arr))
+            if del_other:
+                safe_call(backend.get().af_release_array(other_arr))
             self.arr = out_arr
 
         except RuntimeError as e:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-arrayfire.git



More information about the debian-science-commits mailing list