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.
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.
I am trying to use image files with my app. These image files are compressed in a .zip-file which is opened from the user from the Mail App or Safari. The .zip-file (which contains the image files) is then unzipped by "SSZipArchive". This works without any problem for smaller files (e.g. 5 images, 10KB). But for bigger files (1900 images, 20MB) the app crashes and it is hard to figure out why because it only crashes when the app is not debugging and not watched by Instruments. A few times I got a crash while using the debugger but only when I opened the .zip-Archive from the Mail App. I then got the message "App terminated due to memory pressure".
Please help!
You're probably testing on the Simulator. That's never reliable, because your computer has lots of memory! Test on the device to find out under real-life conditions whether your app uses too much memory. If it does, you'll get a warning and then (if you don't do something about the problem) a deliberate termination.
The root of your problem is that you simply cannot allocate that much memory under iOS or your app/device will crash. A good rule of thumb is that you app might take 10 to 20 megs of memory while running normally, but if it jumps up to 40-80 at any point then you will be in danger of a crash. You should read up on how much memory images use when decompressed under iOS mem blog post and rework your code to make sure things stay in the 10 to 20 meg of memory usage range.
I am currently importing all the facebook birthdays and inserting them in core data,then i sort them according to the latest bday's(fetching and sorting).
When i use facebook to sync and get all the contacts,my app retrieves all the contacts perfectly,but after it receives the contacts it soon crashes..
i tried using zombie objects.
i tried leaks.
i tried adding an exception in exception navigator.
i synced my ipod with itunes went to library and device logs but couldnt find any file which says low memory issue or something that sorta.
i am confused because the reason for the crash doesnt show up,it simply crashes and when i open my app again i can see all the contacts imported from facebook
there is no lldb in the debugger window,when i change it to gdb,i can see gdb but when i use backtrace(bt) it say "No Stack"
i also noticed there is one thing i.e if there are too many contacts my app crashes and if there are less contacts it works normally.
what can be the problem? does it crash because of a memory issue?
how am i supposed to know what is causing the crash?
thanks
Your app is most likely being terminated due to low memory.
The best thing is to look at the device console using Xcode's Organizer:
If iOS is running out of memory and killing your app, you should see something like this:
<Notice>: jetsam: kernel termination snapshot being created
<Warning>: Application 'UIKitApplication:com.yourapp[0x6337]' exited abnormally with signal 9: Killed: 9
You should use the Activity Monitor in Instruments to see how much memory your application is using.
You can also use the Memory Monitor instrument and enable graphing of "Physical Memory Free". If you see the graph approaching 0 before your crash you can be pretty sure it's a memory issue.
Try to put some code for memory releasing into viewDidUnload. For example, if you create a link between code and xib using mouse then xcode generates code for current element automatically.
I can't determine the cause of a crash.
While running the debug build of an app on an iPad 3.1 from Xcode, the app terminates but the debugger doesn't tell me anything. I have an all-exceptions breakpoint and that has certainly worked in the past to catch errors.
Not that I know how to use a crash dump, but when this happens the "Device Log" in the organizer devices pane shows an entry from process "Unknown" of type "Unknown".
I am also having memory warning problems, but in this case I'm not getting the memory warning method invoked (I have a log message and a breakpoint). Could this be a memory warning that doesn't invoke the method ever? [The memory warnings are a puzzle since Instruments isn't showing me any leaks and my own image objects aren't (obviously) being kept in memory -- but that's another problem].
Any idea what is happening to me and how I could get the debugger to trap the condition?
This sounds like your app is getting killed by the system because you allocate too much memory. Depending on how much memory you are allocating, it could very well happen that you never see the memory warning methods being called.
Check your app with instruments running and also check the crash report again, it should give you some more details. E.g. a list of processes with rpages, recent_max and (state) columns, with Largest process: shown above. I bet your process is named and also shows the state (suspended), which means: iOS killed it because you allocated too much memory.
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