Memory allocation increasing in instruments xcode - ios

In my iOS app memory usage keep increasing. App syncs data with remote server. When it requesting data memory usage increase by nearly 15MB per every 3 mins. I don't know how to track allocated objects. I am using ARC. How to overcome this issue.
Edit -
Sometimes these screenshots may help to solve this issue.

Related

Got memory pressure notification (critical) in iOS

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.

What amount of memory should I target for my iOS app?

I am currently showing that my app is using a maximum of 200MB when it is running. Is there a way to tell if this is going to trigger a low memory warning? So far I have not had any issues with the simulator or actuall devices.
We must avoid spiking the memory. For example loading images from disk or cache in loop. This will create a memory spike and it is at this point iOS starts to throw low memory warnings. The exact amount of memory is not specified by Apple. In many applications I have observed that as the memory grows gradually iOS is comfortable and app works properly. But if memory spike occurs low memory warning is thrown.
Apps can use 200 MB of memory these days easily, how ever it is important to simulate and handle low memory warnings in order to be on the safe side.
If you want to trigger low memory warning using simulator, there is a option of doing so in the Menu->Debug of Simulator (Cmd+Shift+M). In device you may load some big images in a for loop. You may also call a private method.
[[UIApplication sharedApplication] performSelector:#selector(_performMemoryWarning)];
Just be sure that this code does not go to production as Apple will reject the binary as private method is being used.

iOS - applicationDidReceiveMemoryWarning - Why?

I'm working with a Unity project that is running on my iOS devices via Xcode, and I'm currently getting the error:
applicationDidReceiveMemoryWarning()
Every second. Yet my memory usage is around 40Mbs, which is 4% of my memory. So how am I getting a memory error? It's also the only app running. There are no other apps running in the background.
Please advise?
Thanks.
I've seen situations where allocated a lot of memory at once (or a lot of small amounts of memory quickly) will cause the app to receive memory warnings. Not sure why that's the case as you'd think it would be ok until you started using too much in total but maybe iOS doesn't like it as it could affect performance of other apps or the OS itself.

iOS app terminated due to memory pressure

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.

ipad - memory warning level 1 ,2 but still having more than enough memory

My iPad app always gives memory warning level 1 or 2, but NEVER crashes. It just display log for warning level 1 or 2, but I CAN continue operate on my app without any problem.
Also I have used activity instrument to monitor the memory usage of my app. It costs at most (peak) 40 MB in the life time.
Can someone tell me why? why it still gives warning when it only used up to 40 mb and never crashes?
Thanks
My iPad app always gives memory warning level 1 or 2, but NEVER crashes. It just display log for warning level 1 or 2, but I CAN continue operate on my app without any problem.
That's exactly how the system is supposed to work. The OS sends memory warnings to every process, and everybody frees some unneeded memory. The OS itself can also kill apps that are currently in the background. If enough memory can be freed, nothing needs to be killed. What good would the warnings be when your app would get killed every time anyway?

Resources