leak reports on hello_word function when using jax.jit #357
Replies: 1 comment 3 replies
-
Nanobind is pretty noisy about leaks—with pybind11, those leaks probably also occurred, but you simply did not know about it. I suppose that Your Python function wrapper might isolate you from doing that since it doesn't reference a specific function but rather includes the code to create that reference at a later point. Ultimately, if your goal is to interface with something like JAX, you can either push the developers of this tool to be more conscious of cleanup and garbage collection when the extension library shuts down. Or you can disable the nanobind warnings (see the docs). If you change nanobind gobal flags like that, then it would be good if you could compile it with |
Beta Was this translation helpful? Give feedback.
-
I'm not sure if this is a nanobind issue but just posting in case someone has seen this. Basically, I was following the jax documentation here to make custom c++/cuda calls in jax but using nanobind instead of pybind11 as in the doc. The code works fine but I see a whole bunch of leak warnings from nanobind only when the functions are called by
jax.jit(myFunction)(args)
. No leak warning if I just callmyFunction(args)
, wheremyFunction
in turn calls the python bindings. Has anyone seen similar things? How do I make sense of it?As a negative control, I make a hello world function that boils down to:
and I can see nanobind report leaks on this function in jax.jit mode
Beta Was this translation helpful? Give feedback.
All reactions