-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 leaks - After running 24 hours it crashes #17049
Comments
This is wild. I thought they fixed all memory leaks, but apparently not. I hope they look at this soon and get your app working. |
@affableashish I think the vast majority of memory leak issues have only been resolved in .NET 8 branches. |
Yeah, we've put most of the memory leak fixes in .NET 8 and not in .NET 7. Before you give up, you might want to test with the latest previews to see if it improves. If it doesn't, let us know! We're still working diligently on tracking these down. Thanks!!!! |
Hi @mgungorchamp. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version. You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
I will test with the new version of NET MAUI, for now I wanted to put this here. |
My application crashes after running for about 4 to 5 hours. However, the console app, which uses the same library, works without any issues. I attempted to use .NET 8 to check for memory leaks, but in release mode, it gets stuck on loading. |
I am trying with the .NET 8. The profiler is not available in the PREV, and debugging to the Android connection gets lost somehow, therefore I do not see when it crashed and why. I opened with log cat. I see these two messages... Seems NET 8 is not there yet. If I am doing something wrong I am open... but it looks I am exhausted the options. Time Device Name Type PID Tag Message And from debug I am clueless ... |
@jonathanpeppers any recommendations? |
The app above ( @mgungorchamp what steps do I take to see the problem? Do I need to login? This page probably has a lot of info on how to troubleshoot issues like this: But if I can just run your app and see for myself, I'm happy to investigate. Thanks! |
To get the image and URL to show you need to add them via the https://infopanel.vermontic.com/ |
Could you try this branch which has the latest NET 8 I use FireTV Stick to test and also Chromecast... it works on tablets/PCs longer time since they have so much memory. |
Which do you think is the problem One thought looking at this code: can you clear the WebView's source when it is not visible? I keep getting this popup, so I'm not sure if I'm able to see the issue or not: |
This is a caught exception, I could not find the solution for it, but seems harmless - due to socket communication - you can ignore it. I tested it on Image and it worked for several days. The image is ok. Webview with Grid faster crash. That's why I tried to tie page Content to webview to eliminate any middleman. By clearing you mean this webView.Source = null; I did not but did not see the behavior change. protected override void OnNavigatedFrom(NavigatedFromEventArgs args) For your question: Can you reproduce this in a smaller sample with a single page? |
What does this mean? Basically, every day I use
An app with only one page with one control, for example, would be great. Right now, there is a lot going on in your app, so it is difficult to pin down where the exact problem is. |
Should I be looking at this issue running on Android or Windows? I don't believe the Diagnostic Tools have ever worked for mobile, but we'd like them to one day. |
Android!!! Please |
Many places you are converting JSON web responses to This is creating a Example here: Are you able to reproduce the issue without any I have not seen the app crash yet on my Pixel 5, I took a diff several minutes apart and there are is only 90kb more memory used: I suspect this is not showing a leak for me. Do I need to setup many images on the site? (https://infopanel.vermontic.com/) Or will a single one show the issue? |
I have it cycling between two images now and the memory goes up and down: Now, keep in mind, I am basically using .NET 8 (dotnet/maui/main), so maybe we have resolved the issue? This one comes to mind, which actually fixed a leak in |
C'mon @mgungorchamp, don't give up on MAUI just yet. |
Thank you for the kind word @affableashish but I am not sure when they are going to fix this memory leak - no timeline - this app should work days without restart... I don't want to move away after this many months of learning investment... |
I completely understand you @mgungorchamp. In the meantime, can you implement a workaround? After MAUI team puts a reliable solution, you can get rid of that worker service. Also please reopen this issue. That way, this issue can make it to MAUI team's backlog and will get worked on (hopefully soon). |
Thanks again @affableashish for the message. But this app will be distributed via the app store, ordinary users cannot do this separate procedure. If there is a way to implement that feature, like when the app crashes, it restarts itself! I don't think this is logically possible, since the app will not be aware of its death. I have started a parallel project, but if this gets solved sooner, I will go back to MAUI before I go so far with Android Studio. |
Not sure how much it's worth it but you can create a simple watchdog application and deploy it alongside your app. References: https://medium.com/@deepakgahlot98/a-never-ending-service-android-263ec5d5dc3b ChatGPT answer: Step 1: Create a Watchdog Android App Define Permissions:
Create a Service:
Add Receiver in Manifest:
Create a BootReceiver:
Step 2: Deploy Your Watchdog App Build Your Watchdog App: Install the Watchdog App: Step 3: Configure Your Watchdog App Configure Package Name: Set Restart Interval: Step 4: Run Your Watchdog App Ensure that your target app is also installed on the same device. |
I agree it's one hell of a workaround and would be nice when MAUI/ runtime team fixes this. |
Maybe just to recap where we are on this issue:
To move further on this, there are two paths @mgungorchamp can take to help us investigate further:
If we had a smaller repro, it would help me investigate any memory leaks (as there should be objects less in memory) -- and we would have something the runtime team would have an easier time investigating. Thanks! |
Hi @mgungorchamp. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
@mgungorchamp Can you try the 2 paths that Jonathan recommended? I'm quite interested in this issue. |
@mgungorchamp Any update on this? |
I paused the development... thank you for the follow-up, though! |
Verified this issue with Visual Studio Enterprise 17.10.0 Preview 1. Can repro on Windows platform with sample project. Memory leak causes VS to crash. |
Description
I have a very simple APP - which shows web pages and images in turn. I am using MS VS Profiler and Objects and Heapisize gradually increases and at the end OOM - Out of Memory happens and the app crashes.
I thought it was on my part, I was using Singleton, and I removed all singleton, no help. Second I was using a recursive call, I went to use while(true), but no help. I was using SemaphoreSlim, and removed it, no help. I took all the blame, but none was helping me.
I though it was Grid view, though Grid view causes a faster OOM crash, but removing it also did not help
The profiler does not show anything about my code doing wrong... This app should run all the time on screens, but it's not usable, I am planning to move from Net MAUI to Native Android Development. I was hoping to get one stone for 4 birds, but I have no bird at all.
I am not sure if anybody will hear my voice... I feel I wasted my months on this app.
Steps to Reproduce
1- Create an app with an Image and Webview on the content page -
2- Then just show images in rotation and websites, Wait ~24 hours on the Android Device will crash, but Windows will survive since there are vast amount of memory
3-Open profiler and observe Objects and Heapisize grow gradually until it can no longer get tolerated by the OS
Link to public reproduction project repository
https://github.com/mgungorchamp/InfoBoard/tree/Semaphore-NoSingletonNoRecursive/InfoBoard
Version with bug
7.0.92
Is this a regression from previous behavior?
No, this is something new, Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Android, Windows
Affected platform versions
All Android
Did you find any workaround?
No workaround
Relevant log output
The text was updated successfully, but these errors were encountered: