-
-
Notifications
You must be signed in to change notification settings - Fork 11.3k
Closed
Labels
Description
Reading attribute "ctypes.data" from an ndarray causes a leak.
version <= 1.14.5 doesn't leak
version >= 1.16.2 leaks
latest 1.16.4 leaks
Reproducing code example:
import numpy as np
import sys
print(np.version.full_version)
data = np.empty(8192)
before = sys.getrefcount(data)
data.ctypes.data
after = sys.getrefcount(data)
print(before, after)
assert before==after
Error message:
File "/mnt/d/code/python/test_numpy_leak.py", line 17, in
assert before==after
AssertionError
Numpy/Python version information:
1.16.4 3.6.8 (default, Jan 14 2019, 11:02:34)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]
Summary (@seberg) 2019-12-03
This has been partially fixed by gh-14469; There are still issues here, although they are mainly issues with upstream ctypes creating deep reference cycles.