Skip to content
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

[iOS, 3.116.1, .NET MAUI 9.0] SkiaSharp still has a memory leak in .NET MAUI on iOS #3106

Open
1 task done
janne-hmp opened this issue Dec 6, 2024 · 3 comments
Open
1 task done
Labels

Comments

@janne-hmp
Copy link

janne-hmp commented Dec 6, 2024

Description

When run with .NET MAUI 9.0 and SkiaSharp 3.116.1, my game GnollHack still runs out of memory on iOS when you try to open the game page many times (two is enough on my old iPad). This does not happen in Xamarin with exactly the same code.

Code

https://github.com/hyvanmielenpelit/GnollHackMAUIEasyBuild

Expected Behavior

No matter how many times the game page is being opened by Play Game button, the game or image carousel never runs out of memory, as old pages with no references to are successfully being garbage collected.

Actual Behavior

When you start the game, you land on main page, which has an image carousel with three alternating pictures and several buttons. Press Play Game (opens game page), then quit (back to main page), press Play Game again (opens another game page), and quit again (back again to main page). Now, you will see that the image carousel on the main page becomes black, as it runs out of memory. You may need to do the process a few times more on iOS devices with a lot of memory.

This means that the memory from the pages is not being released for garbage collection in .NET MAUI 9.0 / SkiaSharp 3.116.1.

Version of SkiaSharp

3.116.0 (Current)

Last Known Good Version of SkiaSharp

2.88.9 (Previous)

IDE / Editor

Visual Studio (Windows)

Platform / Operating System

iOS

Platform / Operating System Version

iOS 18.1.1

Devices

iPad 11,7

Relevant Screenshots

No response

Relevant Log Output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
Copy link

We've found some similar issues:

If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.

Note: You can give me feedback by 👍 or 👎 this comment.

@janne-hmp
Copy link
Author

I might add that the previous memory leak demonstrated in https://github.com/hyvanmielenpelit/iOSMauiSkiaSharpMemoryLeak has in fact been fixed, so this is something different. The earlier fix should help at least with opening simple menu pages as many times as necessary, which already a big improvement, but there's still a further memory leak with GnollHackM's GamePage, which did not exist in Xamarin. This prevents the game from being started more than one time without exiting the app first.

@mattleibow If you can suggest how I could single out the source of the memory leak, happy to try it.

@mattleibow
Copy link
Contributor

@PureWeen do you have the notes cleaned up for the iOS memory leak profiling? If not I can update our wiki based off it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: New
Development

No branches or pull requests

2 participants