Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DrJit / nanobind memory leak warnings #3

Open
andrewgait opened this issue Oct 10, 2024 · 0 comments
Open

DrJit / nanobind memory leak warnings #3

andrewgait opened this issue Oct 10, 2024 · 0 comments
Assignees

Comments

@andrewgait
Copy link
Collaborator

andrewgait commented Oct 10, 2024

Building the photon_emitter and custom_ptracer code against the current master version of Mitsuba3 was successful, and initial testing of scripts gives promising results.

However running a python script containing a photon_emitter and/or a custom_ptracer (I'm not sure which yet) leads to warning messages at the end of the script, for example:

jit_shutdown(): detected 1659 variable leaks:
 - float32 r24[1] = evaluated(), refs=2
 - float32 r25[1] = evaluated(), refs=2
 - float32 r26[1] = evaluated(), refs=1
 - float32 r27[1] = evaluated(), refs=1
 - float32 r28[1] = evaluated(), refs=1
 - float32 r29[1] = evaluated(), refs=1
 - float32 r30[1] = evaluated(), refs=1
 - float32 r33[1] = evaluated(), refs=2
 - float32 r40[1] = evaluated(), refs=2
 - uint32 r46[1] = evaluated(), refs=1
 - uint32 r54[1048576] = counter(), refs=4
 - uint64 r63[1048576] = add(r824, r820), refs=1
 - uint64 r67[1] = literal(), refs=2
 - float32 r79[1] = evaluated(), refs=2
 - float32 r81[1] = evaluated(), refs=2
 - float32 r82[1] = evaluated(), refs=2
 - float32 r83[1] = evaluated(), refs=2
 - float32 r84[1] = evaluated(), refs=2
 - float32 r85[1] = evaluated(), refs=2
 - float32 r87[1] = evaluated(), refs=2
 - float32 r89[1] = evaluated(), refs=8
 - float32 r90[1] = evaluated(), refs=8
 - float32 r91[1] = evaluated(), refs=8
 - float32 r104[1] = evaluated(), refs=2
 - float32 r106[1] = evaluated(), refs=2
 - float32 r111[1] = evaluated(), refs=2
 - float32 r125[1] = evaluated(), refs=2
 - float32 r146[1] = evaluated(), refs=2
 - float32 r157[1] = evaluated(), refs=2
 - float32 r165[1] = evaluated(), refs=2
 - float32 r166[1] = evaluated(), refs=2
 - float32 r169[1] = evaluated(), refs=2
 - float32 r171[1] = evaluated(), refs=8
 - float32 r173[1] = evaluated(), refs=8
 - float32 r174[1] = evaluated(), refs=8
 - float32 r179[1] = evaluated(), refs=2
 - float32 r183[1] = evaluated(), refs=2
 - float32 r217[1] = evaluated(), refs=2
 - float32 r218[1] = evaluated(), refs=2
 - float32 r219[1] = evaluated(), refs=2
 - float32 r220[1] = evaluated(), refs=2
 - float32 r221[1] = evaluated(), refs=2
 - float32 r223[1] = evaluated(), refs=8
 - float32 r233[1] = evaluated(), refs=8
 - float32 r234[1] = evaluated(), refs=8
 - float32 r238[1] = evaluated(), refs=2
 - float32 r242[1] = evaluated(), refs=2
 - float32 r246[1] = evaluated(), refs=2
 - float32 r289[1] = evaluated(), refs=4
 - float32 r290[1] = evaluated(), refs=4
 - (skipping remainder)
jit_registry_shutdown(): leaking 1 instances of type "mitsuba::Sensor".
jit_malloc_shutdown(): leaked
 - host-async memory: 48.02 MiB in 226 allocations
nanobind: leaked 2 instances!
 - leaked instance 0x7f280c06c540 of type "mitsuba.ProjectiveCamera"
 - leaked instance 0x7f27bc001550 of type "mitsuba.AdjointIntegrator"
nanobind: leaked 6 types!
 - leaked type "mitsuba.AdjointIntegrator"
 - leaked type "mitsuba.Object"
 - leaked type "mitsuba.Sensor"
 - leaked type "mitsuba.Integrator"
 - leaked type "mitsuba.ProjectiveCamera"
 - leaked type "mitsuba.Endpoint"
nanobind: leaked 61 functions!
 - leaked function "needs_aperture_sample"
 - leaked function ""
 - leaked function "get_medium"
 - leaked function "id"
 - leaked function "sampler"
 - leaked function "eval_direction"
 - leaked function ""
 - leaked function "pdf_direction"
 - leaked function "near_clip"
 - leaked function "__init__"
 - leaked function "__init__"
 - ... skipped remainder
nanobind: this is likely caused by a reference counting issue in the binding code.

These warnings do not occur when running a notebook containing the same code as the python script.

This seems similar if not identical to the issue at mitsuba-renderer/drjit#87, and this comment on that issue suggests that on shutdown of a script, some DrJit variables get freed in an undesired order, so it's not necessarily a problem, but I thought it worth adding this issue to track that open issue. In a notebook, the kernel continues running once the notebook has finished executing, which is why the warnings are not visible in notebooks.

@andrewgait andrewgait self-assigned this Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant