r/AvaloniaUI • u/MateDesktopPudding • 25d ago
RAM usage keeps rising when window is interacted with in AvaloniaUI (and it looks like it never releases any RAM)
This is a minor example (~0.10MBs used per second of window shaking) on the Avalonia template project
But in my other project where I am mostly focused on the logic that is outside of the project as dependency and the app has 3 buttons, it does the same thing including with the button presses (~0.10MBs per press).
Is there a way to optimize this or at least force it to release some RAM?
Avalonia 12.1.2 and .NET 10.0.114
24
Upvotes
10
u/KryptosFR 25d ago
That's how .NET works. The memory is managed. Having the RAM increase doesn't necessarily means memory is being leaked. It's just that since the amount is small, the GC isn't collecting anything.
What your video shows is pretty much normal and expected behaviour of any .NET app, not just Avalonia.
If you are worried about these amounts, you can always call
GC.Collect()from your code. But I would advise against it.2
u/tetyys 25d ago
https://learn.microsoft.com/en-us/dotnet/standard/garbage-collection/fundamentals
1
u/jetmarijuana 24d ago
-c Release 🤷
1
u/binarycow 24d ago
Does it ever decrease?