-
Notifications
You must be signed in to change notification settings - Fork 249
Open
Labels
Description
Describe the bug
At the end of execution, what appears to be SVM-related pyopencl code causes nanobind leak warnings to appear:
nanobind: leaked 3 instances!
- leaked instance 0x1010fdf88 of type "SVMAllocator"
- leaked instance 0x1076bd3c8 of type "SVMPool"
- leaked instance 0x101459258 of type "Context"
nanobind: leaked 3 types!
- leaked type "pyopencl._cl.SVMAllocator"
- leaked type "pyopencl._cl.Context"
- leaked type "pyopencl._cl.SVMPool"
nanobind: leaked 20 functions!
- leaked function ""
- leaked function ""
- leaked function ""
- leaked function "__eq__"
- leaked function ""
- leaked function "alloc_size"
- leaked function "free_held"
- leaked function "__init__"
- leaked function ""
- leaked function "__call__"
- leaked function "__init__"
- ... skipped remainder
nanobind: this is likely caused by a reference counting issue in the binding code.
To Reproduce
$ cd pyopencl$ python examples/demo_array_svm.py(causes leak warnings)$ python examples/demo_array.py(does not cause leak warnings)
Edit:
Easiest way to reproduce:
$ python -c 'import pyopencl as cl; ctx = cl.create_some_context(); f=cl.SVMAllocation(ctx, 10, 0, 0)'
nanobind: leaked 1 instances!
- leaked instance 0x106203858 of type "Context"
nanobind: leaked 1 types!
- leaked type "pyopencl._cl.Context"
nanobind: leaked 7 functions!
- leaked function "__eq__"
- leaked function "from_int_ptr"
- leaked function "set_default_device_command_queue"
- leaked function "__hash__"
- leaked function ""
- leaked function "get_info"
- leaked function "__init__"
nanobind: this is likely caused by a reference counting issue in the binding code.(when not assigning to f, the warnings do not appear)
Expected behavior
Don't show the warnings.
Environment (please complete the following information):
- OS: MacOS
- Python version: 3.11.9
- PyOpenCL version: 2024.2.2
Additional context
Note that #755 does not address this issue.