diff options
author | Sebastian Berg <sebastian@sipsolutions.net> | 2020-07-23 11:14:38 -0500 |
---|---|---|
committer | Sebastian Berg <sebastian@sipsolutions.net> | 2020-10-19 18:33:40 -0500 |
commit | 028a61af17b2b3d960323fc0a9595bdfd91b9a7e (patch) | |
tree | 7a7e5905d21f846a1db0115137c491388e3b2fed /numpy/array_api/_elementwise_functions.py | |
parent | aebaa8d2dbff7af620a2fca3b5ca9fbb08d4c60c (diff) | |
download | numpy-028a61af17b2b3d960323fc0a9595bdfd91b9a7e.tar.gz |
BUG: Fix memory leak of buffer-info cache due to relaxed strides
When relaxed strides is active (and has an effect), we recalculate
the strides to export "clean" strides in the buffer interface.
(Python and probably some other exporters expect this, i.e. NumPy
has fully switched to and embraced relaxed strides, but the buffer
interface at large probably not.)
The place where "fixing" the strides occured however meant that
when the strides are fixed, the old, cached buffer-info was not
reused when it should have been reused.
This moves the "fixing" logic so that reuse will occur. It leaves
one issue open in that an array shaped e.g. `(1, 10)` is both
C- and F-contiguous. Thus, if it is exported as C-contiguous and
then as F-contiguous, and then *again* as C-contiguous, this will
work, but the last export will compare to the export as an F-contig
buffer and thus still leak memory.
Address gh-16934 (but does leave a small hole)
Diffstat (limited to 'numpy/array_api/_elementwise_functions.py')
0 files changed, 0 insertions, 0 deletions