NVIDIA / cuda-python

CUDA Python Low-level Bindings
https://nvidia.github.io/cuda-python/
Other
874 stars 71 forks source link

Need to make class destruction more robust #141

Open leofang opened 2 weeks ago

leofang commented 2 weeks ago

Possible solutions include

  1. using weakref.finalize() (as you also suggested)
  2. cythonize everything, make all classes cdef'd, and switch from __del__ to __dealloc__
  3. using a lightweight shutdown detection hack (see, e.g., https://github.com/numba/numba/issues/9731#issuecomment-2383856159 and https://github.com/numba/llvmlite/commit/7347d77e5a5494a96fe188108c52ceb8fe39f02c)

_Originally posted by @leofang in https://github.com/NVIDIA/cuda-python/pull/87#discussion_r1792740313_

leofang commented 2 weeks ago

See also https://github.com/NVIDIA/cuda-python/pull/87#discussion_r1793660730. This doesn't seem trivial to me by a curtesy look at the Python atexit docs...

leofang commented 1 week ago

Moving this to beta 2 and bumping to P0