We came across this issue while investigating low memory crashes on iOS Mobile Safari.
Most noticeably on a large HTML5 application, like a HTML5 game, we've found a memory leak on the browser where memory will keep adding up on every refresh.
In our case, the app runs with about 300MB of real memory usage and it added up around 100MB on every refresh.
Most noticeably on iPad mini and iPad4, it would crash Mobile Safari immediately after a couple of refreshes.
After a long and painful endeavour, we've found the issue being caused by a memory leak on webkit.
It happens when you use a matchMedia listener and you don't de-register the event listener before unload.
To fix it, either do not use matchMedia at all, or be sure to de-register the matchMedia event listener onunload of the page.
We've found the issue was already reported at https://code.google.com/p/chromium/issues/detail?id=113983
Related
We have an app built on the iOS 10 SDK. It is presenting images in a UICollectionView and the images are loaded using the SDWebImage framework. It works well, but users have reported that the app suddenly crashes from time to time when scrolling back and forward through the images in the UICollectionView.
We have at last been able to reproduce the error on an iPhone 6 device with the mobile data connection slowed down to 3G.
What happens:
While scrolling quickly up and down through the images, quicker than they can be loaded from the server, suddenly the app crashes back to the iOS desktop. This could happen quickly, after a while, or sometimes it does not happen at all - very inconsistent.
What we have done so far:
Used instruments to check for leaks, the memory consumption is stable and lies constantly around 200Mb.
There are no calls to didReceiveMemoryWarning
We use CrashLytics to detect crashes and exceptions, nothing is logged.
The console or the debugger does not indicate any errors and no exceptions, Xcode just reports that it lost the connection to the phone when the app crashes.
Could anyone suggest an approach for further troubleshooting to nail this?
Stefan
I had a similar issue with SDWebImage. For me, it was because I let SDWebImage keep loading too many images at once. After adding
- (void)prepareForReuse
{
[self.imageView sd_cancelCurrentImageLoad];
}
the issue disappeared.
I read in many places that if user swipes up and kills an app, that app will not be able to receive location updates. I get didEnterRegion and didExitRegion callbacks are received when my app is not killed and is in background. But if I swipe kill app, app doesn't get those callbacks. My question here is,
Is it that app will stop getting callbacks ever? i.e., even if the app is launched again and is in background it does not get the callbacks
I read about startMonitoringSignificantLocationChanges and background app refresh when used together, I can get callback even when app is killed by swipe. I tried this and could not get it working. Is this the expected behavior?
Will startMonitoringSignificantLocationChanges and background app refresh together when used, I get region entry/exit callbacks after rebooting device?
This is not expected behavior. You are supposed to get didEnterRegion and didExitRegion callbacks even after killing an app in the task switcher. If you are not seeing this, something may be wrong with your app or testing methodology. Posting code may be helpful.
A few caveats and tips:
Make sure your app has obtained backround permission with locationManager.requestAlwaysAuthorization(). Without it, it cannot detect at all in the background.
Detection in the killed state did not work on iOS 7.0.x. It started working as of 7.1+.
Make sure you wait long enough to get detections. In some app states, it can take up to 15 minutes.
Before killing your app in testing, check logs to ensure you know what CoreLocation thinks is your current region state. If you turn off a beacon then kill your app, CoreLocation may not have had time to realize the beacon disappeared, thinking it is still inside the region. If you then turn on the beacon, you will not get a new entry event because it thinks you are already inside.
For my app I need to constantly monitor the state of the youtube player but for some reason onStateChange behaves differently on desktop and mobile. In particular I have the following problem: when I try to change the current time of the player to the point that is not buffered yet and the player is currently in PAUSED state, it switches to the BUFFERING state and never goes back to PAUSED state even after it finishes buffering. On the desktop it switches to BUFFERING and then back to PAUSED which is exactly what I want.
I use custom loading overlay when the player is buffering so this behavior complete breaks the functionality. The overlay just gets stuck on mobile devices forever.
If anyone experienced similar issues please let me know.
Thanks.
I am building an app that has several UIWebviews all displaying various content. While testing my app, I ran into an error that said the app was terminated due to memory pressure, and I checked the console, and sure enough I had received a memory warning. Upon further testing, I noticed that this only occurs when visiting a specific page. I noticed that this page contains 2 very large image file (both 5,184px × 3,456px), which is different from the other webpages (there are about 100 and this only happens on this one page), so I think that's where the bug is. Is there a way to get UIWebview to process this and present the page, or is there no hope?
This page also puts this image into a UIImageView of size 320x320, but I don't think this is the problem because the image shows up when I go to the page, but the app crashes when I scroll down the UIWebView
To render a PDF in Objective C we are calling CGContextDrawPDFPage method. In IOS6, interactive PDFs rendering using this method take large amounts of memory and it leads to memory warning after some time. This is because of the caching mechanism of moved pages inside the application. But the application is crashing due to memory warning. When I profile the application in IOS6 the memory is working perfectly in IOS5 and memory is stable. Anybody know about this issue? Are there any changes in PDF rendering(CoreGraphics & QuartzCore) frameworks in IOS6?