-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Memory leak on macOS with Metal rendering #17025
Comments
We are using metal renderer in our app Lunacy since it was introduced. Zero issues at all. Maybe you are using a specific feature we don't use that causes the problem. This issue can be quickly addressed if you will provide a sample app with repro. |
@Mikolaytis open ControlCatalog.NetCore (desktop) on mac. Keep resizing the window for a while (a minute). |
I can confirm this issue is happening on a simple empty window as well. I move around the cursor resizing the window, and the memory usage jumps from 100 megabytes up to 1 gigabyte just in a second. Other than this, everything seems normal, but this surely needs to be fixed! Thanks in advance! |
I can also replicate this, will have to hold off on the 11.2.0 update |
@almenscorner you don't have to. Switch to OpenGL and it will be fine.
|
Now that is looking very promising! thank you @ltetak |
@ltetak OpenGL is somewhat better option than Metal currently regarding memory usage, but somehow this seems to best option right now : AvaloniaNativeRenderingMode.Software |
@MrBandes hardware acceleration backends usually consume more memory, with Skia, regardless of the OS. Though, I don't have expertise to exactly pin-point the reason. Consuming more memory is not a memory leak though. While this issue is about a specific leak. |
On my local tests, resizing window does increase memory usage, but only temporary, after couple of seconds it falls back. Upd: Yes, memory usage is much more stable under #17415 for me. |
@maxkatz6 i know that it's not the same issue. i am just confused now as i see technically the same amount of memory usage of the same application no matter if i choose OpenGL or Software rendering ON Windows. 60 Megabytes +/- 10%. generally the memory usage of an Avalonia application on Windows seems very optimized already, i don't know what should be "normal" on MacOS, but compared to the other it seems a bit too much. this could be somewhat netcore related also and not just because of rendering, but it would need more digging to find it out, but i am not that advanced on these topics. |
@maxkatz6 I tried this nuget I don't have strong data but OpenGL seems still a bit better now. Window resizing stutters from time to time with Metal. Memory consumption is about the same. For completeness: I tried the Software rendering as well. Memory is 500MB lower indeed. The performance is not bad but it stutters at moments (OpenGL is almost flawless). It probably depends on the use case. I work on a video player app where stuttering (missed frames) is not an option. On a normal desktop app you might not mind that. |
Reopening as #17415 wasn't yet merged |
Actually. Just retested on master and #17414 was enough to fix the leak. It does consume more memory than opengl renderer, but that's another issue. |
Describe the bug
There is a slow memory leak on macOS with metal rendering (does not repro on OpenGL or Software).
To Reproduce
Do anything that requires rendering but to speed things up drag a corner of the window and resize it a lot. This will gain 10MB/s. This memory is never freed up and climbs until the app eventually crashes (after a long time).
You can see this memory in the Activity Monitor under the Memory column. It's not calculated under Real Mem. I can't see it in dotMemory as well (is it a GPU memory?)
Expected behavior
Steady memory as with OpenGL or Software rendering.
Avalonia version
11.x - 11.2.0-beta2
OS
macOS
Additional context
It is more prominent since the Metal is the default renderer now #15994
The text was updated successfully, but these errors were encountered: