A Note on NDArray Deallocation Issue in blosc2 Module
Closed this issue · 2 comments
Recently, while working with the blosc2 module in Python, I encountered an error message that said: 'Exception ignored in: 'blosc2.blosc2_ext.NDArray.dealloc''.
This message indicates that there is some issue related to the deallocation of an object of the NDArray class in the blosc2 module. It is important to note this as it could be an indication of other potential issues within the code related to memory management or the use of NDArray objects in the blosc2 module.
It is interesting to note that when I execute only code involving Numba, this error does not occur. This suggests that the issue could be specifically related to the interaction between Numba and the blosc2 module.
" TypeError: 'NoneType' object is not callable
Exception ignored in: 'blosc2.blosc2_ext.NDArray.dealloc' "
https://github.com/omaech/python-blosc2/blob/lazy-expr/blosc2/my_numba.py
For some reason, the link to the Python example that shows the problem does not work. The next code fragment is another example that also shows the problem.
#######################################################################
# Copyright (c) 2019-present, Blosc Development Team <blosc@blosc.org>
# All rights reserved.
#
# This source code is licensed under a BSD-style license (found in the
# LICENSE file in the root directory of this source tree)
#######################################################################
# This shows how to evaluate expressions with NDArray instances as operands.
import numpy as np
import blosc2
import numba as nb
shape = (50, 50)
dtype = np.float64
# Create a NDArray from a NumPy array
npa = np.linspace(0, 1, np.prod(shape)).reshape(shape)
npc = npa + 1
a = blosc2.asarray(npa)
# Get a LazyExpr instance
c = a + 1
# Evaluate! Output is a NDArray
d = c.evaluate()
# Check
assert np.allclose(d[:], npc)
@nb.jit(nopython=True, parallel=True)
def func_numba(x):
out = np.empty(x.shape, x.dtype)
for i in nb.prange(x.shape[0]):
for j in nb.prange(x.shape[1]):
out[i, j] = x[i, j] + 1
return out
nb_res = func_numba(npa)
As in the @omaech example, this program outputs the following error:
TypeError: 'NoneType' object is not callable
Exception ignored in: 'blosc2.blosc2_ext.NDArray.__dealloc__'
TypeError: 'NoneType' object is not callable
TypeError: 'NoneType' object is not callable
Exception ignored in: 'blosc2.blosc2_ext.NDArray.__dealloc__'
TypeError: 'NoneType' object is not callable
If nb_res = func_numba(npa)
is commented out, the error messages disappear.
Doing some experiments, if the blosc2 lazy expression is commented out, but the creation of the b2array is left, it still shows the error. So the problem is not related with the python-blosc2 expressions.