Skip to content

Memory leak with ProgressBar when IsIndeterminate="True" #16648

Description

@ihtfw

Describe the bug

In my application, I encountered a memory leak and, after long debugging, found that if the progress bar has the Intermediate="True" flag, the resources are not released when the window is closed.
I've created the project where this can be reproduced.

https://github.com/ihtfw/AvaloniaProgressBarMemoryLeakDemo

To Reproduce

  • Clone project repo https://github.com/ihtfw/AvaloniaProgressBarMemoryLeakDemo
  • Run project ProgressBarMemoryLeakDemo.Desktop
  • Attach memory profiler. I've used dotMemory
  • Create memory snapshot
  • Click Run Test button in application
  • Wait until it finished
  • Create one more memory snapshot
  • Compare snapshots
  • Now we see that 5 ProgressWindow objects are kept, but they should not!

image

If I change IsIndeterminate to False in ProgressWindow.axaml then everything works as expected.

Expected behavior

Release ProgressWindow object on close

Avalonia version

11.1.2

OS

Windows

Additional context

image

If we check Key retention paths, then it looks like that IsIndeterminate animation is causing problems. In my application I've make temporary fix this problem by changing IsIndeterminate to false in window close event. It solves the problem, but it's definitely incorrect behaviour.

Activity

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions