-
Notifications
You must be signed in to change notification settings - Fork 150
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
[Bug] Button memory leak #245
Comments
The memory leak is caused by the use of animation,There is a |
I get the same issue when testing with borders.
|
I don't know what control you use to display the Border list. It is possible that the control uses animation when displaying the Item. |
This is my XAML code.
|
I tried the same approach on a 'vanilla avalonia project' and the same issue exists. |
Avalonia 11.1.3 with latest SukiUI CI dll Testing reveals that the vanilla Avalonia project(repo in issue description) now does not suffer from memory leaks |
Can we consider the issue fixed ? |
@YJammak was completely right. It seems to be indeed the Loading : With Loading : Without Loading : Fluent Theme : Obviously the little difference between Suki and Fluent Theme is caused by the more complex tree + effect, but at least memory is cleaned correctly when there is no Loading. Let's investigate the Loading control then 👍 |
The animation is 100% causing this. <Style Selector="suki|Loading">
<Style.Animations>
<Animation FillMode="None"
IterationCount="Infinite"
PlaybackDirection="Normal"
Duration="0:0:1.5">
<Animation.Easing>
<QuadraticEaseInOut />
</Animation.Easing>
<KeyFrame Cue="0%">
<Setter Property="RotateTransform.Angle" Value="0" />
</KeyFrame>
<KeyFrame Cue="30%">
<Setter Property="RotateTransform.Angle" Value="0" />
</KeyFrame>
<KeyFrame Cue="100%">
<Setter Property="RotateTransform.Angle" Value="360" />
</KeyFrame>
</Animation>
</Style.Animations>
</Style> Removing this infinite animation resolve the bug. So .. It seems to mean that using infinite animation trigger a memory leak. As this is a standard Avalonia use, I suppose we should raise an issue in the Avalonia repo. Behavior in an empty avalonia project : However, it is quite critical as a Loading control is embedded in every button. @sirdoombox, can you replace the Loading control by your LoadingTest ? I already tested it and it works like a charm an solve the bug, the only difficulty is to be able to set the foreground property and I don't want to make a mess in your "SukiEffect" code 🥲 there's no hurry though |
I should have some time to look into this tomorrow. It should be relatively easy to add some extra uniforms for setting colours, though I didn't mess around with that loading control much beyond just showing it was possible. |
Fixed in #297 (Tested with 1000 buttons, memory usage is flat) |
Check the following items
Description of the issue
I will create an application in the interface in which many buttons are used. While running the application, I noticed that every time the interface is updated, the amount of RAM required increases. After some research, I found that whenever the application needs to render a button, the necessary amount of memory increases. Also, I checked FluentTheme, it doesn't have similar behavior. I have created a repository with a project that reproduces this problem https://github.com/gubard/AvaloniaItemsControlMemoryLeak. Just run the project and press the start button.
Package Version
6.0.0-beta7
Environment
Windows 11 Pro 23H2 22631.3810 and Garuda Linux Bird of Prey x86_64
Expected Behavior
The amount of required RAM should not increase each time the button is rendered
Reproduction
Rendering the button and then clearing it. And so constantly
Additional Information
No response
The text was updated successfully, but these errors were encountered: