File tree Expand file tree Collapse file tree
cuda/pathfinder/_dynamic_libs Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -62,6 +62,18 @@ def load_nvidia_dynamic_lib(libname: str) -> LoadedDL:
6262 Returns:
6363 LoadedDL: Object containing the OS library handle and absolute path.
6464
65+ **Important:**
66+
67+ **Never close the returned handle.** Do **not** call ``dlclose`` (Linux) or
68+ ``FreeLibrary`` (Windows) on the ``LoadedDL._handle_uint``.
69+
70+ **Why:** the return value is cached (``functools.cache``) and shared across the
71+ process. Closing the handle can unload the module while other code still uses
72+ it, leading to crashes or subtle failures.
73+
74+ This applies to Linux and Windows. For context, see issue #1011:
75+ https://github.com/NVIDIA/cuda-python/issues/1011
76+
6577 Raises:
6678 DynamicLibNotFoundError: If the library cannot be found or loaded.
6779 RuntimeError: If Python is not 64-bit.
Original file line number Diff line number Diff line change 88
99Released on Sep 25, 2025
1010
11+ Important update to the ``load_nvidia_dynamic_lib `` documentation
12+ -----------------------------------------------------------------
13+
14+ The documentation for :func: `cuda.pathfinder.load_nvidia_dynamic_lib ` now calls out
15+ an important behavior:
16+
17+ * **Do not close ** the OS handle returned (``LoadedDL._handle_uint ``). Avoid
18+ ``dlclose `` (Linux) and ``FreeLibrary `` (Windows).
19+
20+ * **Reason: ** the function's result is cached (``functools.cache ``) and shared across
21+ the process. Closing the handle can unload the module while other code still holds
22+ a reference, which may cause crashes or latent errors.
23+
24+ This note is documentation‑only; there is no API change in 1.3.0. See issue #1011
25+ for background and discussion:
26+ https://github.com/NVIDIA/cuda-python/issues/1011
1127
1228Highlights
1329----------
You can’t perform that action at this time.
0 commit comments