Skip to content

potential bug: reference leak when torch is loaded and a function errors #666

@ncullen93

Description

@ncullen93

When torch is loaded and a function errors, there is a reference leak reported when the ipython console is exited. This does not seem to happen in a normal python console and only when torch is loaded. Very weird.. I've seen this a few other times but never reproducible so unsure if it's the same issue or if there's a general reference leak.

import ants
import torch
img = ants.image_read(ants.get_data('r16'))
img.crop_indices([0,0],[10,1000])

Then exit() and you get this:

nanobind: leaked 1 instances!
 - leaked instance 0x13362a208 of type "AntsImageF2"
nanobind: leaked 1 types!
 - leaked type "ants.lib.AntsImageF2"
nanobind: leaked 1 functions!
 - leaked function "cropImage"
nanobind: this is likely caused by a reference counting issue in the binding code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions