summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Lamparski <diagonaldevice@gmail.com>2017-08-29 18:26:26 -0400
committerMichael Lamparski <diagonaldevice@gmail.com>2017-08-29 23:56:59 -0400
commit684f27f9849fa0db852033917911328bf253a6ac (patch)
treeaae680a241ebddb55f619bcf43fb1f3225aa9b1c
parent0032e535f7ebbcb4528dbbedb9c71b47914071c7 (diff)
downloadnumpy-684f27f9849fa0db852033917911328bf253a6ac.tar.gz
TST: test for leak in np.dot of size 0 arrays
-rw-r--r--numpy/core/tests/test_multiarray.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py
index ba4b0e0d8..74f6a3af9 100644
--- a/numpy/core/tests/test_multiarray.py
+++ b/numpy/core/tests/test_multiarray.py
@@ -2497,6 +2497,17 @@ class TestMethods(object):
if HAS_REFCOUNT:
assert_(sys.getrefcount(a) < 50)
+ def test_size_zero_memleak(self):
+ # Regression test for issue 9615
+ # Exercises a special-case code path for dot products of length
+ # zero in cblasfuncs (making it is specific to floating dtypes).
+ a = np.array([], dtype=np.float64)
+ x = np.array(2.0)
+ for _ in range(100):
+ np.dot(a, a, out=x)
+ if HAS_REFCOUNT:
+ assert_(sys.getrefcount(x) < 50)
+
def test_trace(self):
a = np.arange(12).reshape((3, 4))
assert_equal(a.trace(), 15)