Skip to content

Potential GPU Memory Leak in LabelStats when label is on GPU but image is on CPU in auto3dseg/analyzer.py #8697

Closed

Description

@benediktjohannes

Current code only checks image tensor for CUDA device

If label tensor is on GPU (even if image is on CPU), torch.cuda.empty_cache() is not called

This can cause GPU memory leaks during connected component analysis

(in auto3dseg/analyzer.py)

Activity

  1. added a commit that references this issue on Jan 17, 2026
    aa93e6c
  2. ericspod commented on Mar 3, 2026

    @ericspod
    Member

    I believe this has now been addressed.

  3. benediktjohannes commented on Mar 3, 2026

    @benediktjohannes
    ContributorAuthor

    @ericspod thanks for the answer! Unforetunately, I don't think that this has been addressed since there were only 2 PRs (and one was closed because I reopened it lateron with some changes) and the other is still open? Or is there any other commit fixing this?

  4. ericspod commented on Mar 3, 2026

    @ericspod
    Member

    Yes that's true, the fixing PR is another one which isn't merged yet. I think there's code formatting at least on #8708 which needs resolving then it can be merged.

  5. benediktjohannes commented on Mar 3, 2026

    @benediktjohannes
    ContributorAuthor

    Thanks for the quick answer! That's true! I'll have a look on this as soon as possible. 👍

  6. added a commit that references this issue on Apr 2, 2026
    853f702
  7. added a commit that references this issue on May 25, 2026
    f0cb118
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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