The app plays video n audio from the bundle. When I'm testing the app on my iPod Touch, SOMETIMES just before the video is getting played, it logs the message. sometimes when the app wants to prepare the audioplayer (in another viewController) it logs the message.
However I haven't had a crash YET! :D I'm not sure if there's gonna be a crash if it runs on other devices which have multiple apps open.
So, should I worry about this? should I prepareAudioPlayer or moviePlayer in another thread?
or just ignore it?
Even if you prepare it on other threads it will not solve this issue, what you have to do is to prepare your self for when you recieve a memory warning to act upon it and free some memory that you dont need
Try to free some memory up, optimize your application memory consumption, using lazy loading technique and so on, but using another thread is definitely not a solution
Related
I am downloading media contents from server and app crashes after certain time by giving following error:
Got memory pressure notification (critical)
Removed all object when I get warning in didReceiveMemoryWarning function but no luck.
How can I resolve this crash? Is there any way that I can restart the view controller after freeing all memory?
Make sure you are not retaining anything in memory from all the stuff you download. There are some API calls (like imageNamed for instance) that store things into a memory cache and that will kill your app if you do too much of it too quickly.
Also crashlogs won't help. You should check memory usage in instruments to see where it's going.
When will iOS trigger the didReceiveMemoryWarning method?
I am getting a crash in my app while playing an DRM encryped video.
Check the below screenshot. I am using only 27mb of RAM and I am getting a memory warning in the console as you can see in the image and the app simply crashes. What can be the possible reason?
I tried profiling the app using allocation instrument. I checked the discard events with freed memory and ran the app. There also I am getting the memory warning message even though the app only uses ~50mb of RAM.Please check the image below.
I am working on a iOS Application for >=iOS8 Devices. My app is memory intensive which becomes a problem since the app can crash. I have CrashLoggers in place that report crashes on the app during the next start. However there are certain scenarios when the app may consume higher than usual memory and the OS may terminate it. Is there any delegate that I could use to detect an OS forced app termination?
I tried [AppDelegate applicationWillTerminate:] and [AppDelegate applicationDidReceiveMemoryWarning:] but they are going to give me false positives for the most part. The problem is that this is not a exception, but a system signal raised by OS to kill the app that I am trying to detect within the scope of the event.
I am a new programmer. Let me know if I am understanding things incorrectly or I am making impractical assumptions.
I have read the following links:
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplicationDelegate_Protocol/index.html#//apple_ref/occ/intfm/UIApplicationDelegate/applicationWillTerminate:
Is there any method in appDelegate which is called when application crashes?
I understand that preventing the problem is better than cure. But here I am trying to detect if there's going to be a problem. It's not like the app always crashes. There may be some edge case scenarios or users on very old devices like iPhone 4s/iPad Air 1 for which the app can run (possibly) into problems. So, I need a logging mechanism around this.
The runtime of the app is ~120MB worst case which is high but well under the range of too high. While the app has a lot of features, Image processing in the app is difficult to perform while maintaining the quality and also to profile in terms of memory(spikes depend on size, quality of image, lighting, etc.). So my app is well within the boundary line, and I am asking for way to detect if the app crosses this boundary when used by the user.
I totally agree with optimization(or fixing the crash) suggestion that you gave, and I would try my best to optimize(or de-bug) the app.
When app crashes or is killed by the system, there is no signal that you can catch meaningfully.
What makes you think applicationDidReceiveMemoryWarning: is giving you false warnings?
Receiving a memory warning and then not being killed is not a false positive. That just means your app didn't increase memory allocations enough to cross the threshold.
When you receive a memory warning, log if you want, but also decrease memory usage.
How do you know that the maximum runtime allocation footprint is 120MB? Depending on device, you'll have anywhere from around 125MB (iPad 1) to well over 1GB of memory available on modern devices (more on iPad Pro).
You should be getting your applicationDidReceiveMemoryWarning: called when the system is under memory pressure. This can be simulated by selecting the Simulate Memory Warning menu item in the Hardware menu.
If you actually go over your memory limit on device, you'll get jetsamed (SIGKILLed). You can't detect that.
If you want to simulate the jetsam, just send your process a SIGKILL (kill -9 <pid>)
I am trying to find a way to capture low memory crashes.
Most crash reporting tools, for example Crashlytics, do not capture low memory os kills.
https://twitter.com/crashlytics/status/235018252647010304
http://support.crashlytics.com/knowledgebase/articles/123408-do-you-catch-out-of-memory-crashes
Does anyone know of any crash reporting tools that catch low memory crashes?
Or, does anyone know of a way to detect these crashes w/out any added reporting tools?
Thanks!
You can't "catch" a low memory warning, but you can be notified in advance of them happening. You can implement applicationDidReceiveMemoryWarning: in your app delegate or respond to the UIApplicationDidReceiveMemoryWarningNotification. Aside from that, your app isn't notified when it's terminated.
You can also store transient data in NSCache, and it'll disappear under memory pressure.
My iOS app can record video by using AVCaptureSession and play video at the same time.
but the problem is that app gets much slower after completed this function.
I don't know why... My app is ARC mode and I tried my recorder class that contains AVCaptureSession to nil but the problem was not solved.
Please tell me the possible reasons make app slow after recording video.
Thank.
It's very important where you are storing recorded files.The large files should be saved in document directory instead of RAM.So don't save your recorded file in improper places like NSUserDefault,which results slow performance and memory issue.
ARC doesn't mean you should not manage your memory. Make sure the used memory is deallocated after recording the video. Maybe there is some leak?