[x] I have tried using the latest released version of Numba (most recent is
visible in the change log (https://github.com/numba/numba/blob/master/CHANGE_LOG).
[x] I have included below a minimal working reproducer (if you are unsure how
to write one see http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports).
OS: 64bit Mac OS X 10.14.6 18G4032
Kernel: x86_64 Darwin 18.7.0
CPU: Intel Core i7-4750HQ @ 2.00GHz
$ python --version
Python 3.8.2
$ python -c 'import numba; print(numba.__version__)'
0.51.2
import numpy as np
import numba
@numba.njit
def list_comp(arr):
[np.log(x) for x in arr]
arr = np.arange(10)
for _ in range(10000):
list_comp(arr)
stats = numba.core.runtime.rtsys.get_allocation_stats()
print("stats:", stats.alloc - stats.free)
stats: 0
import numpy as np
import numba
@numba.njit
def list_comp(arr):
map(np.log, arr)
arr = np.arange(10)
for _ in range(10000):
list_comp(arr)
stats = numba.core.runtime.rtsys.get_allocation_stats()
print("stats:", stats.alloc - stats.free)
stats: 10000
I really liked using numba, thanks for all the hard work building it.
This seems related to bugs with yield, but a yield isn't used here, which makes this bug really hard to find.
I hope this gets taken care of.
Thanks for the report and kind words, glad you like Numba. I can reproduce what you see and suspect that this is because internally Numba's map yields:
Dupe of #5350?
Technically I think yes, but I'm inclined to leave this as a direct reminder that the map builtin is leaking. Thanks!